Text.XML.HXT.Arrow.XmlState.SystemConfig

hxt-9.3.1.22: A collection of tools for processing XML with Haskell.

Copyright | Copyright (C) 2010 Uwe Schmidt
License | MIT
Maintainer | Uwe Schmidt (uwe@fh-wedel.de)
Stability | stable
Portability | portable
Safe Haskell | None
Language | Haskell2010

Text.XML.HXT.Arrow.XmlState.SystemConfig

Description

system configuration and common options options

Synopsis

- withTrace :: Int -> SysConfig
- withSysAttr :: String -> String -> SysConfig
- withAcceptedMimeTypes :: [String] -> SysConfig
- withMimeTypeHandler :: String -> IOSArrow XmlTree XmlTree -> SysConfig
- withMimeTypeFile :: String -> SysConfig
- withFileMimeType :: String -> SysConfig
- withWarnings :: Bool -> SysConfig
- withErrors :: Bool -> SysConfig
- withRemoveWS :: Bool -> SysConfig
- withPreserveComment :: Bool -> SysConfig
- withParseByMimeType :: Bool -> SysConfig
- withParseHTML :: Bool -> SysConfig
- withValidate :: Bool -> SysConfig
- withSubstDTDEntities :: Bool -> SysConfig
- withSubstHTMLEntities :: Bool -> SysConfig
- withCheckNamespaces :: Bool -> SysConfig
- withCanonicalize :: Bool -> SysConfig
- withIgnoreNoneXmlContents :: Bool -> SysConfig
- withStrictInput :: Bool -> SysConfig
- withEncodingErrors :: Bool -> SysConfig
- withInputEncoding :: String -> SysConfig
- withDefaultBaseURI :: String -> SysConfig
- withInputOption :: String -> String -> SysConfig
- withInputOptions :: Attributes -> SysConfig
- withRedirect :: Bool -> SysConfig
- withProxy :: String -> SysConfig
- withIndent :: Bool -> SysConfig
- withOutputEncoding :: String -> SysConfig
- withOutputXML :: SysConfig
- withOutputHTML :: SysConfig
- withOutputXHTML :: SysConfig
- withOutputPLAIN :: SysConfig
- withXmlPi :: Bool -> SysConfig
- withNoEmptyElemFor :: [String] -> SysConfig
- withAddDefaultDTD :: Bool -> SysConfig
- withTextMode :: Bool -> SysConfig
- withShowTree :: Bool -> SysConfig
- withShowHaskell :: Bool -> SysConfig
- withCompression :: (CompressionFct, DeCompressionFct) -> SysConfig
- withStrictDeserialize :: Bool -> SysConfig
- yes :: Bool
- no :: Bool

# Documentation

withTrace :: Int -> SysConfig #

`withTrace level` : system option, set the trace level, (0..4)

withSysAttr :: String -> String -> SysConfig #

`withSysAttr key value` : store an arbitrary key value pair in system state

withAcceptedMimeTypes :: [String] -> SysConfig #

Specify the set of accepted mime types.

All contents of documents for which the mime type is not found in this list are discarded.

withMimeTypeHandler :: String -> IOSArrow XmlTree XmlTree -> SysConfig #

Specify a content handler for documents of a given mime type

withMimeTypeFile :: String -> SysConfig #

`withMimeTypeFile filename` : input option, set the mime type table for `file:` documents by given file. The format of this config file must be in the syntax of a debian linux "mime.types" config file

withFileMimeType :: String -> SysConfig #

Force a given mime type for all file contents.

The mime type for file access will then not be computed by looking into a mime.types file

withWarnings :: Bool -> SysConfig #

`withWarnings yes/no` : system option, issue warnings during reading, HTML parsing and processing, default is `yes`

withErrors :: Bool -> SysConfig #

`withErrors yes/no` : system option for suppressing error messages, default is `no`

withRemoveWS :: Bool -> SysConfig #

`withRemoveWS yes/no` : read and write option, remove all whitespace, used for document indentation, default is `no`

withPreserveComment :: Bool -> SysConfig #

`withPreserveComment yes/no` : read option, preserve comments during canonicalization, default is `no`

withParseByMimeType :: Bool -> SysConfig #

`withParseByMimeType yes/no` : read option, select the parser by the mime type of the document (pulled out of the HTTP header).

When the mime type is set to "text/html" the configured HTML parser is taken, when it's set to "text/xml" or "text/xhtml" the configured XML parser is taken. If the mime type is something else, no further processing is performed, the contents is given back to the application in form of a single text node. If the default document encoding is set to isoLatin1, this even enables processing of arbitray binary data.

withParseHTML :: Bool -> SysConfig #

`withParseHTML yes/no`: read option, use HTML parser, default is `no` (use XML parser)

withValidate :: Bool -> SysConfig #

`withValidate yes/no`: read option, validate document against DTD, default is `yes`

withSubstDTDEntities :: Bool -> SysConfig #

`withSubstDTDEntities yes/no`: read option, substitute general entities defined in DTD, default is `yes`. switching this option and the validate option off can lead to faster parsing, because then there is no need to access the DTD

withSubstHTMLEntities :: Bool -> SysConfig #

`withSubstHTMLEntities yes/no`: read option, substitute general entities defined in HTML DTD, default is `no`. switching this option on and the substDTDEntities and validate options off can lead to faster parsing because there is no need to access a DTD, but still the HTML general entities are substituted

withCheckNamespaces :: Bool -> SysConfig #

`withCheckNamespaces yes/no`: read option, check namespaces, default is `no`

withCanonicalize :: Bool -> SysConfig #

`withCanonicalize yes/no` : read option, canonicalize document, default is `yes`

withIgnoreNoneXmlContents :: Bool -> SysConfig #

`withIgnoreNoneXmlContents yes/no` : input option, ignore document contents of none XML/HTML documents.

This option can be useful for implementing crawler like applications, e.g. an URL checker. In those cases net traffic can be reduced.

withStrictInput :: Bool -> SysConfig #

`withStrictInput yes/no` : input option, input of file and HTTP contents is read eagerly, default is `no`

withEncodingErrors :: Bool -> SysConfig #

`withEncodingErrors yes/no` : input option, ignore all encoding errors, default is `no`

withInputEncoding :: String -> SysConfig #

`withInputEncoding encodingName` : input option

Set default document encoding (`utf8`, `isoLatin1`, `usAscii`, `iso8859_2`, ... , `iso8859_16`, ...). Only XML, HTML and text documents are decoded, default decoding for XML/HTML is utf8, for text iso latin1 (no decoding).

withDefaultBaseURI :: String -> SysConfig #

`withDefaultBaseURI URI` , input option, set the default base URI

This option can be useful when parsing documents from stdin or contained in a string, and interpreting relative URIs within the document

withInputOption :: String -> String -> SysConfig #

withInputOptions :: Attributes -> SysConfig #

withRedirect :: Bool -> SysConfig #

`withRedirect yes/no` : input option, automatically follow redirected URIs, default is `yes`

withProxy :: String -> SysConfig #

`withProxy "host:port"` : input option, configure a proxy for HTTP access, e.g. www-cache:3128

withIndent :: Bool -> SysConfig #

`withIndent yes/no` : output option, indent document before output, default is `no`

withOutputEncoding :: String -> SysConfig #

`withOutputEncoding encoding` , output option, default is the default input encoding or utf8, if input encoding is not set

withOutputXML :: SysConfig #

`withOutputXML` : output option, default writing

Default is writing XML: quote special XML chars >,<,",',& where neccessary, add XML processing instruction and encode document with respect to `withOutputEncoding`

withOutputHTML :: SysConfig #

Write XHTML: quote all special XML chars, use HTML entity refs or char refs for none ASCII chars

withOutputXHTML :: SysConfig #

Write XML: quote only special XML chars, don't substitute chars by HTML entities, and don't generate empty elements for HTML elements, which may contain any contents, e.g. `src=.../script` instead of `src=... /`

withOutputPLAIN :: SysConfig #

suppreses all char and entitiy substitution

withXmlPi :: Bool -> SysConfig #

withNoEmptyElemFor :: [String] -> SysConfig #

withAddDefaultDTD :: Bool -> SysConfig #

withTextMode :: Bool -> SysConfig #

withShowTree :: Bool -> SysConfig #

withShowHaskell :: Bool -> SysConfig #

withCompression :: (CompressionFct, DeCompressionFct) -> SysConfig #

Configure compression and decompression for binary serialization/deserialization. First component is the compression function applied after serialization, second the decompression applied before deserialization.

withStrictDeserialize :: Bool -> SysConfig #

Strict input for deserialization of binary data

yes :: Bool #

no :: Bool #