|
|
|
|
|
Description |
A variant of Node in which Element nodes have an annotation of any type,
and some concrete functions that annotate with the XML parse location.
It is assumed you will usually want Tree or Annotated, not both, so many
of the names conflict.
Support for qualified and namespaced trees annotated with location information
is not complete.
|
|
Synopsis |
|
| | type Attributes tag text = [(tag, text)] | | type UNode text a = Node text text a | | type UAttributes text = Attributes text text | | type LNode tag text = Node tag text XMLParseLocation | | type ULNode text = LNode text text | | textContent :: Monoid text => Node tag text a -> text | | unannotate :: Node tag text a -> Node tag text | | data QName text = QName {} | | type QNode text a = Node (QName text) text a | | type QAttributes text = Attributes (QName text) text | | type QLNode text = LNode (QName text) text | | data NName text = NName {} | | type NNode text a = Node (NName text) text a | | type NAttributes text = Attributes (NName text) text | | type NLNode text = LNode (NName text) text | | mkNName :: text -> text -> NName text | | mkAnNName :: text -> NName text | | xmlnsUri :: GenericXMLString text => text | | xmlns :: GenericXMLString text => text | | parseSAX :: (GenericXMLString tag, GenericXMLString text) => Maybe Encoding -> ByteString -> [SAXEvent tag text] | | parseSAXThrowing :: (GenericXMLString tag, GenericXMLString text) => Maybe Encoding -> ByteString -> [SAXEvent tag text] | | parseSAXLocations :: (GenericXMLString tag, GenericXMLString text) => Maybe Encoding -> ByteString -> [(SAXEvent tag text, XMLParseLocation)] | | parseSAXLocationsThrowing :: (GenericXMLString tag, GenericXMLString text) => Maybe Encoding -> ByteString -> [(SAXEvent tag text, XMLParseLocation)] | | parseTree :: (GenericXMLString tag, GenericXMLString text) => Maybe Encoding -> ByteString -> (LNode tag text, Maybe XMLParseError) | | parseTree' :: (GenericXMLString tag, GenericXMLString text) => Maybe Encoding -> ByteString -> Either XMLParseError (LNode tag text) | | parseTreeThrowing :: (GenericXMLString tag, GenericXMLString text) => Maybe Encoding -> ByteString -> LNode tag text | | | | data XMLParseError = XMLParseError String XMLParseLocation | | data XMLParseLocation = XMLParseLocation {} | | parse :: (GenericXMLString tag, GenericXMLString text) => ParserOptions tag text -> ByteString -> (LNode tag text, Maybe XMLParseError) | | parse' :: (GenericXMLString tag, GenericXMLString text) => ParserOptions tag text -> ByteString -> Either XMLParseError (LNode tag text) | | parseThrowing :: (GenericXMLString tag, GenericXMLString text) => ParserOptions tag text -> ByteString -> LNode tag text | | | | saxToTree :: GenericXMLString tag => [(SAXEvent tag text, a)] -> (Node tag text a, Maybe XMLParseError) | | data XMLParseException = XMLParseException XMLParseError | | class (Monoid s, Eq s) => GenericXMLString s where | |
|
|
|
Tree structure
|
|
|
Annotated variant of the tree representation of the XML document.
| Constructors | Element | | eName :: !tag | | eAttrs :: ![(tag, text)] | | eChildren :: [Node tag text a] | | eAnn :: a | |
| Text !text | |
| Instances | |
|
|
type Attributes tag text = [(tag, text)] | Source |
|
Type shortcut for attributes
|
|
|
Type shortcut for a single annotated node with unqualified tag names where
tag and text are the same string type
|
|
|
Type shortcut for attributes with unqualified names where tag and
text are the same string type.
|
|
|
Type shortcut for a single annotated node, annotated with parse location
|
|
|
Type shortcut for a single node with unqualified tag names where
tag and text are the same string type, annotated with parse location
|
|
|
Extract all text content from inside a tag into a single string, including
any text contained in children.
|
|
|
|
Qualified nodes
|
|
|
A qualified name.
Qualified names have two parts, a prefix and a local part. The local part
is the name of the tag. The prefix scopes that name to a particular
group of legal tags.
The prefix will usually be associated with a namespace URI. This is usually
achieved by using xmlns attributes to bind prefixes to URIs.
| Constructors | QName | | qnPrefix :: Maybe text | | qnLocalPart :: !text | |
|
| Instances | |
|
|
|
Type shortcut for a single annotated node where qualified names are used for tags
|
|
|
Type shortcut for attributes with qualified names
|
|
|
Type shortcut for a single node where qualified names are used for tags, annotated with parse location
|
|
Namespaced nodes
|
|
|
A namespace-qualified tag.
NName has two components, a local part and an optional namespace. The local part is the
name of the tag. The namespace is the URI identifying collections of declared tags.
Tags with the same local part but from different namespaces are distinct. Unqualified tags
are those with no namespace. They are in the default namespace, and all uses of an
unqualified tag are equivalent.
| Constructors | NName | | nnNamespace :: Maybe text | | nnLocalPart :: !text | |
|
| Instances | |
|
|
|
Type shortcut for a single annotated node where namespaced names are used for tags
|
|
|
Type shortcut for attributes with namespaced names
|
|
|
Type shortcut for a single node where namespaced names are used for tags, annotated with parse location
|
|
|
Make a new NName from a prefix and localPart.
|
|
|
Make a new NName with no prefix.
|
|
|
|
|
|
Deprecated parse functions
|
|
|
|
|
|
|
|
|
|
|
parseSAXLocationsThrowing | Source |
|
|
|
|
|
|
|
|
|
|
|
|
Parse to tree
|
|
|
Encoding types available for the document encoding.
| Constructors | |
|
|
|
Parse error, consisting of message text and error location
| Constructors | | Instances | |
|
|
|
Specifies a location of an event within the input text
| Constructors | XMLParseLocation | | xmlLineNumber :: Int64 | Line number of the event
| xmlColumnNumber :: Int64 | Column number of the event
| xmlByteIndex :: Int64 | Byte index of event from start of document
| xmlByteCount :: Int64 | The number of bytes in the event
|
|
| Instances | |
|
|
|
|
|
|
|
|
|
:: (GenericXMLString tag, GenericXMLString text) | | => ParserOptions tag text | Input text (a lazy ByteString)
| -> ByteString | | -> LNode tag text | | Lazily parse XML to tree. In the event of an error, throw XMLParseException.
parseThrowing can throw an exception from pure code, which is generally a bad
way to handle errors, because Haskell's lazy evaluation means it's hard to
predict where it will be thrown from. However, it may be acceptable in
situations where it's not expected during normal operation, depending on the
design of your program.
|
|
|
SAX-style parse
|
|
|
Constructors | StartElement tag [(tag, text)] | | EndElement tag | | CharacterData text | | FailDocument XMLParseError | |
| Instances | |
|
|
|
A lower level function that lazily converts a SAX stream into a tree structure.
Variant that takes annotations for start tags.
|
|
Variants that throw exceptions
|
|
|
An exception indicating an XML parse error, used by the ..Throwing variants.
| Constructors | | Instances | |
|
|
Abstraction of string types
|
|
|
An abstraction for any string type you want to use as xml text (that is,
attribute values or element text content). If you want to use a
new string type with hexpat, you must make it an instance of
GenericXMLString.
| | Methods | | | Instances | |
|
|
Produced by Haddock version 2.6.0 |