Library for processing XML data.
Warning: the structure of this library is not stable and might be changed in the future!
Author: Michael Hanus
Version: June 2018
tagOf
:: XmlExp -> String
Returns the tag of an XML element (or empty for a textual element). |
elemsOf
:: XmlExp -> [XmlExp]
Returns the child elements an XML element. |
textOf
:: [XmlExp] -> String
Extracts the textual contents of a list of XML expressions. |
textOfXml
:: [XmlExp] -> String
Included for backward compatibility, better use textOf !
|
xtxt
:: String -> XmlExp
Basic text (maybe containing special XML chars). |
xml
:: String -> [XmlExp] -> XmlExp
XML element without attributes. |
writeXmlFile
:: String -> XmlExp -> IO ()
Writes a file with a given XML document. |
writeXmlFileWithParams
:: String -> [XmlDocParams] -> XmlExp -> IO ()
Writes a file with a given XML document and XML parameters. |
showXmlDoc
:: XmlExp -> String
Show an XML document in indented format as a string. |
showXmlDocWithParams
:: [XmlDocParams] -> XmlExp -> String
|
readXmlFile
:: String -> IO XmlExp
Reads a file with an XML document and returns the corresponding XML expression. |
readUnsafeXmlFile
:: String -> IO (Maybe XmlExp)
Tries to read a file with an XML document and returns the corresponding XML expression, if possible. |
readFileWithXmlDocs
:: String -> IO [XmlExp]
Reads a file with an arbitrary sequence of XML documents and returns the list of corresponding XML expressions. |
parseXmlString
:: String -> [XmlExp]
Transforms an XML string into a list of XML expressions. |
updateXmlFile
:: (XmlExp -> XmlExp) -> String -> IO ()
An action that updates the contents of an XML file by some transformation on the XML document. |
The data type for representing XML expressions.
Constructors:
XText
:: String -> XmlExp
: a text string (PCDATA)
XElem
:: String -> [(String,String)] -> [XmlExp] -> XmlExp
: an XML element with tag field, attributes, and a list
of XML elements as contents
The data type for encodings used in the XML document.
Constructors:
StandardEnc
:: Encoding
Iso88591Enc
:: Encoding
The data type for XML document parameters.
Constructors:
Enc
:: Encoding -> XmlDocParams
: the encoding for a document
DtdUrl
:: String -> XmlDocParams
: the url of the DTD for a document
Returns the tag of an XML element (or empty for a textual element).
|
Returns the child elements an XML element.
|
Extracts the textual contents of a list of XML expressions. Useful auxiliary function when transforming XML expressions into other data structures.
For instance,
|
Basic text (maybe containing special XML chars).
|
XML element without attributes.
|
Writes a file with a given XML document. |
Writes a file with a given XML document and XML parameters. |
Show an XML document in indented format as a string. |
|
Reads a file with an XML document and returns the corresponding XML expression. |
Tries to read a file with an XML document and returns the corresponding XML expression, if possible. If file or parse errors occur, Nothing is returned. |
Reads a file with an arbitrary sequence of XML documents and returns the list of corresponding XML expressions. |
Transforms an XML string into a list of XML expressions. If the XML string is a well structured document, the list of XML expressions should contain exactly one element. |
An action that updates the contents of an XML file by some transformation on the XML document.
|