Safe Haskell | None |
---|
This module provides functions to format a tree structure or SAX stream as UTF-8 encoded XML.
The formatting functions always outputs only UTF-8, regardless
of what encoding is specified in the document's XMLDeclaration
.
If you want to output a document in another encoding, then make sure the
XMLDeclaration
agrees with the final output encoding, then format the
document, and convert from UTF-8 to your desired encoding using some text
conversion library.
The lazy ByteString
representation of the output in generated with very
small chunks, so in some applications you may want to combine them into
larger chunks to get better efficiency.
- format :: (NodeClass n [], GenericXMLString tag, GenericXMLString text) => n [] tag text -> ByteString
- format' :: (NodeClass n [], GenericXMLString tag, GenericXMLString text) => n [] tag text -> ByteString
- formatG :: (NodeClass n c, GenericXMLString tag, GenericXMLString text) => n c tag text -> c ByteString
- formatNode :: (NodeClass n [], GenericXMLString tag, GenericXMLString text) => n [] tag text -> ByteString
- formatNode' :: (NodeClass n [], GenericXMLString tag, GenericXMLString text) => n [] tag text -> ByteString
- formatNodeG :: (NodeClass n c, GenericXMLString tag, GenericXMLString text) => n c tag text -> c ByteString
- formatDocument :: (DocumentClass d [], GenericXMLString tag, GenericXMLString text) => d [] tag text -> ByteString
- formatDocument' :: (DocumentClass d [], GenericXMLString tag, GenericXMLString text) => d [] tag text -> ByteString
- formatDocumentG :: (DocumentClass d c, GenericXMLString tag, GenericXMLString text) => d c tag text -> c ByteString
- xmlHeader :: ByteString
- treeToSAX :: forall tag text n c. (GenericXMLString tag, GenericXMLString text, Monoid text, NodeClass n c) => n c tag text -> c (SAXEvent tag text)
- documentToSAX :: forall tag text d c. (GenericXMLString tag, GenericXMLString text, Monoid text, DocumentClass d c) => d c tag text -> c (SAXEvent tag text)
- formatSAX :: (GenericXMLString tag, GenericXMLString text) => [SAXEvent tag text] -> ByteString
- formatSAX' :: (GenericXMLString tag, GenericXMLString text) => [SAXEvent tag text] -> ByteString
- formatSAXG :: forall c tag text. (List c, GenericXMLString tag, GenericXMLString text) => c (SAXEvent tag text) -> c ByteString
- indent :: (NodeClass n c, GenericXMLString tag, GenericXMLString text) => Int -> n c tag text -> n c tag text
- indent_ :: forall n c tag text. (NodeClass n c, GenericXMLString tag, GenericXMLString text) => Int -> Int -> n c tag text -> n c tag text
High level
format :: (NodeClass n [], GenericXMLString tag, GenericXMLString text) => n [] tag text -> ByteStringSource
Format document with <?xml.. header - lazy variant that returns lazy ByteString.
format' :: (NodeClass n [], GenericXMLString tag, GenericXMLString text) => n [] tag text -> ByteStringSource
Format document with <?xml.. header - strict variant that returns strict ByteString.
formatG :: (NodeClass n c, GenericXMLString tag, GenericXMLString text) => n c tag text -> c ByteStringSource
Format document with <?xml.. header - generalized variant that returns a generic list of strict ByteStrings.
formatNode :: (NodeClass n [], GenericXMLString tag, GenericXMLString text) => n [] tag text -> ByteStringSource
Format XML node with no header - lazy variant that returns lazy ByteString.
formatNode' :: (NodeClass n [], GenericXMLString tag, GenericXMLString text) => n [] tag text -> ByteStringSource
Format XML node with no header - strict variant that returns strict ByteString.
formatNodeG :: (NodeClass n c, GenericXMLString tag, GenericXMLString text) => n c tag text -> c ByteStringSource
Format XML node with no header - generalized variant that returns a generic list of strict ByteStrings.
Format document (for use with Extended.hs)
formatDocument :: (DocumentClass d [], GenericXMLString tag, GenericXMLString text) => d [] tag text -> ByteStringSource
Format an XML document - lazy variant that returns lazy ByteString.
formatDocument' :: (DocumentClass d [], GenericXMLString tag, GenericXMLString text) => d [] tag text -> ByteStringSource
Format an XML document - strict variant that returns strict ByteString.
formatDocumentG :: (DocumentClass d c, GenericXMLString tag, GenericXMLString text) => d c tag text -> c ByteStringSource
Format an XML document - generalized variant that returns a generic list of strict ByteStrings.
Low level
The standard XML header with UTF-8 encoding.
treeToSAX :: forall tag text n c. (GenericXMLString tag, GenericXMLString text, Monoid text, NodeClass n c) => n c tag text -> c (SAXEvent tag text)Source
Flatten a tree structure into SAX events, monadic version.
documentToSAX :: forall tag text d c. (GenericXMLString tag, GenericXMLString text, Monoid text, DocumentClass d c) => d c tag text -> c (SAXEvent tag text)Source
formatSAX :: (GenericXMLString tag, GenericXMLString text) => [SAXEvent tag text] -> ByteStringSource
Format SAX events with no header - lazy variant that returns lazy ByteString.
formatSAX' :: (GenericXMLString tag, GenericXMLString text) => [SAXEvent tag text] -> ByteStringSource
Format SAX events with no header - strict variant that returns strict ByteString.
:: forall c tag text . (List c, GenericXMLString tag, GenericXMLString text) | |
=> c (SAXEvent tag text) | SAX events |
-> c ByteString |
Format SAX events with no header - generalized variant that uses generic list.
Indentation
:: (NodeClass n c, GenericXMLString tag, GenericXMLString text) | |
=> Int | Number of indentation spaces per nesting level |
-> n c tag text | |
-> n c tag text |
Make the output prettier by adding indentation.
:: forall n c tag text . (NodeClass n c, GenericXMLString tag, GenericXMLString text) | |
=> Int | Initial indent (spaces) |
-> Int | Number of indentation spaces per nesting level |
-> n c tag text | |
-> n c tag text |
Make the output prettier by adding indentation, specifying initial indent.