hexpat-0.18.3: XML parser/formatter based on expat

Text.XML.Expat.Format

Contents

Description

This module provides functions to format a tree structure or SAX stream as UTF-8 encoded XML.

Synopsis

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.

Deprecated names

formatTree :: (NodeClass n [], GenericXMLString tag, GenericXMLString text) => n [] tag text -> ByteStringSource

DEPRECATED: Renamed to format.

formatTree' :: (NodeClass n [], GenericXMLString tag, GenericXMLString text) => n [] tag text -> ByteStringSource

DEPRECATED: Renamed to format'.

Low level

xmlHeader :: ByteStringSource

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.

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.

formatSAXGSource

Arguments

:: 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

indentSource

Arguments

:: (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.

indent_Source

Arguments

:: 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.