tinyXml-0.1.0.2: A fast DOM parser for a subset of XML

Safe HaskellNone
LanguageHaskell2010

Text.Xml.Tiny

Contents

Description

This module contains functions for parsing an XML document and deconstructing the AST.

Synopsis

Documentation

data Node Source #

A parsed XML node

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

contents :: Config => Node -> [Either ByteString Node] Source #

Get the slices of a node, including both the content strings (as Left, never blank) and the direct child nodes (as Right). If you only want the child nodes, use children.

location :: Config => Node -> (Int, Int) Source #

Get the (line, col) coordinates of a node

data Attribute Source #

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.

children :: Node -> [Node] Source #

Get the direct child nodes of this node.

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.

newtype SrcLoc Source #

Constructors

SrcLoc Int 

Instances

rerender :: Node -> ByteString Source #

Returns the XML bytestring reconstructed from the parsed AST. For the original XML, use outer

Orphan instances