Safe Haskell | Safe-Infered |
---|
Text.XmlHtml.Common
- data Document
- = XmlDocument {
- docEncoding :: !Encoding
- docType :: !(Maybe DocType)
- docContent :: ![Node]
- | HtmlDocument {
- docEncoding :: !Encoding
- docType :: !(Maybe DocType)
- docContent :: ![Node]
- = XmlDocument {
- data Node
- = TextNode !Text
- | Comment !Text
- | Element {
- elementTag :: !Text
- elementAttrs :: ![(Text, Text)]
- elementChildren :: ![Node]
- isTextNode :: Node -> Bool
- isComment :: Node -> Bool
- isElement :: Node -> Bool
- tagName :: Node -> Maybe Text
- getAttribute :: Text -> Node -> Maybe Text
- hasAttribute :: Text -> Node -> Bool
- setAttribute :: Text -> Text -> Node -> Node
- nodeText :: Node -> Text
- childNodes :: Node -> [Node]
- childElements :: Node -> [Node]
- childElementsTag :: Text -> Node -> [Node]
- childElementTag :: Text -> Node -> Maybe Node
- descendantNodes :: Node -> [Node]
- descendantElements :: Node -> [Node]
- descendantElementsTag :: Text -> Node -> [Node]
- descendantElementTag :: Text -> Node -> Maybe Node
- data DocType = DocType !Text !ExternalID !InternalSubset
- data ExternalID
- data InternalSubset
- data Encoding
- encodingName :: Encoding -> Text
- encoder :: Encoding -> Text -> ByteString
- decoder :: Encoding -> ByteString -> Text
- isUTF16 :: Encoding -> Bool
- fromText :: Encoding -> Text -> Builder
Documentation
Represents a document fragment, including the format, encoding, and document type declaration as well as its content.
Constructors
XmlDocument | |
Fields
| |
HtmlDocument | |
Fields
|
A node of a document structure. A node can be text, a comment, or an element. XML processing instructions are intentionally omitted as a simplification, and CDATA and plain text are both text nodes, since they ought to be semantically interchangeable.
Constructors
TextNode !Text | |
Comment !Text | |
Element | |
Fields
|
isTextNode :: Node -> BoolSource
Determines whether the node is text or not.
tagName :: Node -> Maybe TextSource
Gives the tag name of an element, or Nothing
if the node isn't an
element.
setAttribute :: Text -> Text -> Node -> NodeSource
Sets the attribute name to the given value. If the Node
is not an
element, this is the identity.
childNodes :: Node -> [Node]Source
Gives the child nodes of the given node. Only elements have child nodes.
childElements :: Node -> [Node]Source
Gives the child elements of the given node.
childElementsTag :: Text -> Node -> [Node]Source
Gives all of the child elements of the node with the given tag name.
childElementTag :: Text -> Node -> Maybe NodeSource
Gives the first child element of the node with the given tag name,
or Nothing
if there is no such child element.
descendantNodes :: Node -> [Node]Source
Gives the descendants of the given node in the order that they begin in the document.
descendantElements :: Node -> [Node]Source
Gives the descendant elements of the given node, in the order that their start tags appear in the document.
descendantElementsTag :: Text -> Node -> [Node]Source
Gives the descendant elements with a given tag name.
descendantElementTag :: Text -> Node -> Maybe NodeSource
Gives the first descendant element of the node with the given tag name,
or Nothing
if there is no such element.
A document type declaration. Note that DTD internal subsets are currently unimplemented.
Constructors
DocType !Text !ExternalID !InternalSubset |
data ExternalID Source
An external ID, as in a document type declaration. This can be a SYSTEM identifier, or a PUBLIC identifier, or can be omitted.
Instances
data InternalSubset Source
The internal subset is unparsed, but preserved in case it's actually wanted.
Constructors
InternalText !Text | |
NoInternalSubset |
Instances
The character encoding of a document. Currently only the required character encodings are implemented.
encodingName :: Encoding -> TextSource
Retrieves the preferred name of a character encoding for embedding in a document.
encoder :: Encoding -> Text -> ByteStringSource
Gets the encoding function from Text
to ByteString
for an encoding.
decoder :: Encoding -> ByteString -> TextSource
Gets the decoding function from ByteString
to Text
for an encoding.