hexpat-0.19.10: XML parser/formatter based on expat

Safe Haskell | None

Text.XML.Expat.Internal.DocumentClass

Description

Type classes to allow for XML handling functions to be generalized to work with different document types.

Synopsis

- data XMLDeclaration text = XMLDeclaration text (Maybe text) (Maybe Bool)
- data DocumentTypeDeclaration c tag text = DocumentTypeDeclaration
- data Misc text
  - = Comment !text
  - | ProcessingInstruction !text !text
- type family NodeType d :: (* -> *) -> * -> * -> *
- class (Functor c, List c, NodeClass (NodeType d) c) => DocumentClass d c where
  - getXMLDeclaration :: d c tag text -> Maybe (XMLDeclaration text)
  - getDocumentTypeDeclaration :: d c tag text -> Maybe (DocumentTypeDeclaration c tag text)
  - getTopLevelMiscs :: d c tag text -> c (Misc text)
  - getRoot :: d c tag text -> NodeType d c tag text
  - mkDocument :: Maybe (XMLDeclaration text) -> Maybe (DocumentTypeDeclaration c tag text) -> c (Misc text) -> NodeType d c tag text -> d c tag text
- mkPlainDocument :: DocumentClass d c => NodeType d c tag text -> d c tag text
- modifyXMLDeclaration :: DocumentClass d c => (Maybe (XMLDeclaration text) -> Maybe (XMLDeclaration text)) -> d c tag text -> d c tag text
- modifyDocumentTypeDeclaration :: DocumentClass d c => (Maybe (DocumentTypeDeclaration c tag text) -> Maybe (DocumentTypeDeclaration c tag text)) -> d c tag text -> d c tag text
- modifyTopLevelMiscs :: DocumentClass d c => (c (Misc text) -> c (Misc text)) -> d c tag text -> d c tag text
- modifyRoot :: DocumentClass d c => (NodeType d c tag text -> NodeType d c tag text) -> d c tag text -> d c tag text

# Documentation

data XMLDeclaration text

XML declaration, consisting of version, encoding and standalone.

The formatting functions always outputs only UTF-8, regardless of what encoding is specified here. If you want to produce a document in a different encoding, then set the encoding here, format the document, and then convert the output text from UTF-8 to your desired encoding using some text conversion library.

Constructors

XMLDeclaration text (Maybe text) (Maybe Bool) |

Instances

Eq text => Eq (XMLDeclaration text) |
Show text => Show (XMLDeclaration text) |

data DocumentTypeDeclaration c tag text

Stub for future expansion.

Constructors

DocumentTypeDeclaration |

Instances

Eq (DocumentTypeDeclaration c tag text) |
Show (DocumentTypeDeclaration c tag text) |

data Misc text

Constructors

Comment !text |
ProcessingInstruction !text !text |

Instances

Eq text => Eq (Misc text) |
Show text => Show (Misc text) |
NFData text => NFData (Misc text) |

type family NodeType d :: (* -> *) -> * -> * -> *

class (Functor c, List c, NodeClass (NodeType d) c) => DocumentClass d c where

Methods

getXMLDeclaration :: d c tag text -> Maybe (XMLDeclaration text)

Get the XML declaration for this document.

getDocumentTypeDeclaration :: d c tag text -> Maybe (DocumentTypeDeclaration c tag text)

Get the Document Type Declaration (DTD) for this document.

getTopLevelMiscs :: d c tag text -> c (Misc text)

Get the top-level `Misc` nodes for this document.

getRoot :: d c tag text -> NodeType d c tag text

Get the root element for this document.

mkDocument :: Maybe (XMLDeclaration text) -> Maybe (DocumentTypeDeclaration c tag text) -> c (Misc text) -> NodeType d c tag text -> d c tag text

Make a document with the specified fields.

Instances

(Functor c, List c) => DocumentClass (DocumentG ann) c |

mkPlainDocument :: DocumentClass d c => NodeType d c tag text -> d c tag text

Make a document with the specified root node and all other information set to defaults.

modifyXMLDeclaration :: DocumentClass d c => (Maybe (XMLDeclaration text) -> Maybe (XMLDeclaration text)) -> d c tag text -> d c tag text

modifyDocumentTypeDeclaration :: DocumentClass d c => (Maybe (DocumentTypeDeclaration c tag text) -> Maybe (DocumentTypeDeclaration c tag text)) -> d c tag text -> d c tag text

modifyTopLevelMiscs :: DocumentClass d c => (c (Misc text) -> c (Misc text)) -> d c tag text -> d c tag text

modifyRoot :: DocumentClass d c => (NodeType d c tag text -> NodeType d c tag text) -> d c tag text -> d c tag text