alice
library
manual.

Alice Project

The XML structure


________ Synopsis ____________________________________________________

    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 ______________________________________________________

    import structure XML from "x-alice:/lib/xml/XML"

________ Interface ___________________________________________________

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
  

________ Description _________________________________________________

parse fileName

Opens an XML file and returns the root node.

name node

Returns the name, i.e. the XML tag, of a node.

children node

Returns the list of children of node.

null node

Tests whether node is null, i.e. an illegal node. null e.g. returned if you ask for the root node's parent.

parent node

Returns the parent of node.

properties node

Returns the list of properties that node has. Each property is again an xml_node.

getType node

Returns the type of node.

getProp node prop

If node has property prop with value v, return SOME v, otherwise NONE.

getContent node

If node contains text content text, return SOME text, otherwise NONE.



last modified 1970/01/01 01:00