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 XMLError of string 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 val parseString : 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
Parses the file fileName into an xml document tree and returns the root node. If this is not successfull, for example because the file does not exist or is malformed, this operation raises the XMLError exception with a string describing the error.
Parses the string s into an xml document tree and returns the root node. If this is not successfull, for example because the string is malformed, this operation raises the XMLError exception with a string describing the error.
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. A null node is e.g. returned if you ask for the root node's parent.
Returns the parent of node, or null for the root.
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.