HaXml-1.25.8: Utilities for manipulating XML documents

Text.XML.HaXml.ParseLazy

Description

A non-validating XML parser. For the input grammar, see http://www.w3.org/TR/REC-xml.

Synopsis

# Parse a whole document

To parse a whole document, xmlParse file content takes a filename (for generating error reports) and the string content of that file. A parse error causes program failure, with message to stderr.

# Parse just a DTD

To parse just a DTD, dtdParse file content takes a filename (for generating error reports) and the string content of that file. If no DTD was found, you get Nothing rather than an error. However, if a DTD is found but contains errors, the program crashes.

# Parse a partial document

xmlParseWith :: XParser a -> [(Posn, TokenT)] -> (Either String a, [(Posn, TokenT)]) Source #

To parse a partial document, e.g. from an XML-based stream protocol, where you may later want to get more document elements from the same stream. Arguments are: a parser for the item you want, and the already-lexed input to parse from. Returns the item you wanted (or an error message), plus the remainder of the input.

# Individual parsers for use with xmlParseWith and module SAX

Return an entire XML document including prolog and trailing junk.

Return a complete element including all its inner content.

Return a content particle, e.g. text, element, reference, etc

Return an XML comment.

Return parsed freetext (i.e. until the next markup)

Return either a general entity reference, or a character reference.

Return a DOCTYPE decl, indicating a DTD.

Parse a processing instruction.

Parse only the parts between angle brackets in an element tag.

Return a qualified name (although the namespace qualification is not processed here; this is merely to get the correct type).

Return just a name, e.g. element name, attribute name.

Return the next token from the input only if it matches the given token.

For use with stream parsers - returns the complete opening element tag.

For use with stream parsers - accepts a closing tag, provided it matches the given element name.

emptySTs :: SymTabs Source #

Some empty symbol tables for GE and PE references.

type XParser a = Parser SymTabs (Posn, TokenT) a Source #

XParser is just a specialisation of the PolyStateLazy parser.

# These general utility functions don't belong here

fst3 :: (a, b, c) -> a Source #

snd3 :: (a, b, c) -> b Source #

thd3 :: (a, b, c) -> c Source #