HaXml-1.25.10: Utilities for manipulating XML documents
Safe HaskellSafe-Inferred
LanguageHaskell98

Text.XML.HaXml

Description

This is just a convenient way of bunching the XML combinators together with some other things you are likely to want at the same time.

Synopsis

Documentation

xmlParse :: String -> String -> Document Posn Source #

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.

dtdParse :: String -> String -> Maybe DocTypeDecl Source #

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.

htmlParse :: String -> String -> Document Posn Source #

The first argument is the name of the file, the second is the string contents of the file. The result is the generic representation of an XML document. Any errors cause program failure with message to stderr.

validate :: DocTypeDecl -> Element i -> [String] Source #

validate takes a DTD and a tagged element, and returns a list of errors in the document with respect to its DTD.

If you have several documents to validate against a single DTD, then you will gain efficiency by freezing-in the DTD through partial application, e.g. checkMyDTD = validate myDTD.

fix2Args :: IO (String, String) Source #

This useful auxiliary checks the commandline arguments for two filenames, the input and output file respectively. If either is missing, it is replaced by -, which can be interpreted by the caller as stdin and/or stdout.

processXmlWith :: CFilter Posn -> IO () Source #

The wrapper processXmlWith returns an IO () computation that collects the filenames (or stdin/stdout) to use when reading/writing XML documents. Its CFilter argument is applied to transform the XML document from the input and write it to the output. No DTD is attached to the output.

If the input filename ends with .html or .htm, it is parsed using the error-correcting HTML parser rather than the strict XML parser.

render :: Doc -> String #

Render the Doc to a String using the default Style (see style).