Module "XML.curry"

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: December 2006


 Exported names:

Datatypes:
Encoding | XmlDocParams | XmlExp

Constructors:
DtdUrl | Enc | Iso88591Enc | StandardEnc | XElem | XText

Functions:
parseXmlString | readFileWithXmlDocs | readUnsafeXmlFile | readXmlFile | showXmlDoc | showXmlDocWithParams | textOfXml | updateXmlFile | writeXmlFile | writeXmlFileWithParams | xml | xtxt


 Summary of exported functions:

xtxt  :: String -> XmlExp  deterministic 
          Basic text (maybe containing special XML chars).
xml  :: String -> [XmlExp] -> XmlExp  deterministic 
          XML element without attributes.
writeXmlFile  :: String -> XmlExp -> IO ()  deterministic 
          Writes a file with a given XML document.
writeXmlFileWithParams  :: String -> [XmlDocParams] -> XmlExp -> IO ()  deterministic 
          Writes a file with a given XML document and XML parameters.
showXmlDoc  :: XmlExp -> String  deterministic 
          Show an XML document in indented format as a string.
showXmlDocWithParams  :: [XmlDocParams] -> XmlExp -> String  deterministic flexible+rigid
          
readXmlFile  :: String -> IO XmlExp  deterministic 
          Reads a file with an XML document and returns the corresponding XML expression.
readUnsafeXmlFile  :: String -> IO (Maybe XmlExp)  deterministic 
          Tries to read a file with an XML document and returns the corresponding XML expression, if possible.
readFileWithXmlDocs  :: String -> IO [XmlExp]  deterministic 
          Reads a file with an arbitrary sequence of XML documents and returns the list of corresponding XML expressions.
parseXmlString  :: String -> [XmlExp]  deterministic 
          Transforms an XML string into a list of XML expressions.
textOfXml  :: [XmlExp] -> String  deterministic 
          Extracts the textual contents of a list of XML expressions.
updateXmlFile  :: (XmlExp -> XmlExp) -> String -> IO ()  deterministic 
          An action that updates the contents of an XML file by some transformation on the XML document.

 Imported modules:

Char
List
Prelude
Read

 Exported datatypes:

XmlExp

The data type for representing XML expressions.

Constructors:

XText :: String -> XmlExp

XText - a text string (PCDATA)

XElem :: String -> [(String,String)] -> [XmlExp] -> XmlExp

XElem - an XML element with tag field, attributes, and a list of XML elements as contents


Encoding

The data type for encodings used in the XML document.

Constructors:

StandardEnc :: Encoding
Iso88591Enc :: Encoding


XmlDocParams

The data type for XML document parameters.

Constructors:

Enc :: Encoding -> XmlDocParams

Enc - the encoding for a document

DtdUrl :: String -> XmlDocParams

DtdUrl - the url of the DTD for a document



 Exported functions:

xtxt :: String -> XmlExp  deterministic 

Basic text (maybe containing special XML chars).

Further infos:
  • solution complete, i.e., able to compute all solutions

xml :: String -> [XmlExp] -> XmlExp  deterministic 

XML element without attributes.

Further infos:
  • solution complete, i.e., able to compute all solutions

writeXmlFile :: String -> XmlExp -> IO ()  deterministic 

Writes a file with a given XML document.


writeXmlFileWithParams :: String -> [XmlDocParams] -> XmlExp -> IO ()  deterministic 

Writes a file with a given XML document and XML parameters.


showXmlDoc :: XmlExp -> String  deterministic 

Show an XML document in indented format as a string.


showXmlDocWithParams :: [XmlDocParams] -> XmlExp -> String  deterministic flexible+rigid

Further infos:
  • incompletely defined

readXmlFile :: String -> IO XmlExp  deterministic 

Reads a file with an XML document and returns the corresponding XML expression.


readUnsafeXmlFile :: String -> IO (Maybe XmlExp)  deterministic 

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.


readFileWithXmlDocs :: String -> IO [XmlExp]  deterministic 

Reads a file with an arbitrary sequence of XML documents and returns the list of corresponding XML expressions.


parseXmlString :: String -> [XmlExp]  deterministic 

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.


textOfXml :: [XmlExp] -> String  deterministic 

Extracts the textual contents of a list of XML expressions. Useful auxiliary function when transforming XML expression into other data structures.
For instance, textOfXml [XText "xy", XElem "a" [] [], XText "ab"] == "xy ab"


updateXmlFile :: (XmlExp -> XmlExp) -> String -> IO ()  deterministic 

An action that updates the contents of an XML file by some transformation on the XML document.

Example call:  (updateXmlFile f file)

Parameters:
f - the function to transform the XML document in the file
file - the name of the XML file


Generated by CurryDoc (Version 0.4.1 of June 7, 2007) at Aug 28 15:33:24 2008