Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains functions for parsing an XML document and deconstructing the AST.
- data Node
- name :: Config => Node -> ByteString
- inner :: Config => Node -> ByteString
- outer :: Config => Node -> ByteString
- contents :: Config => Node -> [Either ByteString Node]
- location :: Config => Node -> (Int, Int)
- data Attribute = Attribute {}
- parse :: Config => ByteString -> Either Error Node
- children :: Node -> [Node]
- childrenBy :: Config => Node -> ByteString -> [Node]
- attributes :: Config => Node -> [Attribute]
- attributeBy :: Config => Node -> ByteString -> Maybe Attribute
- newtype SrcLoc = SrcLoc Int
- data Error = Error ErrorType CallStack
- data ErrorType
- rerender :: Node -> ByteString
Documentation
name :: Config => Node -> ByteString Source #
The tag name
inner :: Config => Node -> ByteString Source #
The content of the tag, excluding the tag itself
outer :: Config => Node -> ByteString Source #
The contents of the tag, including the tag itself
A parsed XML attribute
parse :: Config => ByteString -> Either Error Node Source #
Parse an XML bytestring, returning a root node with name "" and the content AST, or an error. Note that the returned AST references the input bytestring and will therefore keep it alive.
childrenBy :: Config => Node -> ByteString -> [Node] Source #
Get the direct children of this node which have a specific name.
attributes :: Config => Node -> [Attribute] Source #
The attributes in the tag, if any.
attributeBy :: Config => Node -> ByteString -> Maybe Attribute Source #
Get the first attribute of this node which has a specific name, if there is one.
rerender :: Node -> ByteString Source #
Returns the XML bytestring reconstructed from the parsed AST.
For the original XML, use outer