signature XML
structure XML : XML
The XML structure provides a simple XML parser. It is based on the libxml2 library (see the libxml2 web page for further details).
import structure XML from "x-alice:/lib/xml/XML"
signature XML =
sig
type xml_node
exception DocumentParsingError
datatype xml_node_type =
ATTRIBUTE_DECL
| ATTRIBUTE_NODE
| CDATA_SECTION_NODE
| COMMENT_NODE
| DOCB_DOCUMENT_NODE
| DOCUMENT_FRAG_NODE
| DOCUMENT_NODE
| DOCUMENT_TYPE_NODE
| DTD_NODE
| ELEMENT_DECL
| ELEMENT_NODE
| ENTITY_DECL
| ENTITY_NODE
| ENTITY_REF_NODE
| HTML_DOCUMENT_NODE
| NAMESPACE_DECL
| NOTATION_NODE
| PI_NODE
| TEXT_NODE
| XINCLUDE_END
| XINCLUDE_START
val parse : string -> xml_node
fun name : xml_node -> string
fun children : xml_node -> xml_node list
fun null : xml_node -> bool
fun parent : xml_node -> xml_node
fun properties : xml_node -> xml_node list
fun getType : xml_node -> xml_node_type
fun getProp : xml_node -> string -> string option
fun getContent : xml_node -> bool -> string option
end
Opens an XML file and returns the root node.
Returns the name, i.e. the XML tag, of a node.
Returns the list of children of node.
Tests whether node is null, i.e. an illegal node. null e.g. returned if you ask for the root node's parent.
Returns the parent of node.
Returns the list of properties that node has. Each property is again an xml_node.
Returns the type of node.
If node has property prop with value v, return SOME v, otherwise NONE.
If node contains text content text, return SOME text, otherwise NONE.