HaXml-1.25.14: Utilities for manipulating XML documents

Safe Haskell | None
Language | Haskell98

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

- module Text.XML.HaXml.Types
- module Text.XML.HaXml.Combinators
- xmlParse :: String -> String -> Document Posn
- dtdParse :: String -> String -> Maybe DocTypeDecl
- element :: Element i -> Doc
- module Text.XML.HaXml.Html.Generate
- htmlParse :: String -> String -> Document Posn
- validate :: DocTypeDecl -> Element i -> [String]
- fix2Args :: IO (String, String)
- processXmlWith :: CFilter Posn -> IO ()
- module Text.XML.HaXml.Verbatim
- module Text.XML.HaXml.Escape
- render :: Doc -> String
- version :: String

# Documentation

module Text.XML.HaXml.Types

module Text.XML.HaXml.Combinators

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.

element :: Element i -> Doc Source #

module Text.XML.HaXml.Html.Generate

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.

module Text.XML.HaXml.Verbatim

module Text.XML.HaXml.Escape

render :: Doc -> String Source #

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

version :: String Source #