IXML Programming Guide
IXML Programming Guide
2
IXML v1.2
Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3 BOOL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4 DOM Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.1 Interface Node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.2 Interface Attr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.3 Interface CDATASection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.4 Interface Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.5 Interface Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.6 Interface NamedNodeMap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.7 Interface NodeList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
5 IXML API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
[Link]
July 4, 2006 2
IXML v1.2
[Link]
July 4, 2006 3
1 Introduction
Introduction
The Linux DOM2 XML Parser Version 1.2 (IXML) is a lightweight, portable XML parser support-
ing the standard Document Object Model (DOM) Level 2 interfaces. The parser uses a C-style
interface, making it idea for small, embedded applications. This document describes the interfaces
supported by IXML 1.2, referencing the W3C DOM2 recommendations when necessary, and the
additional utility application programming interfaces (APIs) that it supports.
Note that this document assumes that the reader has a copy of the DOM2-Core recommen-
dation. Refer to the link below to obtain a copy. Only a brief description is included here and
the reader is pointed to the DOM2-Core recommendation for more details. This document does,
however, clarify IXML-specific behavior when the recommendation is unclear.
About DOM
The Document Object Model (DOM) is a set of interfaces that give a programmatic interface
to documents. It provides a platform-neutral and language-neutral interface for random access
and updating elements inside XML documents. DOM Level 1 provided the basic interfaces to
access document elements. DOM Level 2 extended the interfaces to provide proper support for
XML namespaces.
The latest DOM 2 recommendation is maintained by W3C and is available from
[Link]
[Link]
July 4, 2006 4
2 License
License
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
• Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
• Redistributions in binary form must reproduce the above copyright notice, this list of con-
ditions and the following disclaimer in the documentation and/or other materials provided
with the distribution.
• Neither name of Intel Corporation nor the names of its contributors may be used to endorse
or promote products derived from this software without specific prior written permission.
[Link]
July 4, 2006 5
3 BOOL
[Link]
July 4, 2006 6
4 DOM Interfaces
DOM Interfaces
Names
4.1 Interface Node ........................................ 7
4.2 Interface Attr ........................................ 19
4.3 Interface CDATASection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.4 Interface Document ........................................ 21
4.5 Interface Element ........................................ 33
4.6 Interface NamedNodeMap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.7 Interface NodeList ........................................ 49
The Document Object Model consists of a set of objects and interfaces for accessing and manip-
ulating documents. IXML does not implement all the interfaces documented in the DOM2-Core
recommendation but defines a subset of the most useful interfaces. A description of the supported
interfaces and methods is presented in this section.
For a complete discussion on the object model, the object hierarchy, etc., refer to section 1.1
of the DOM2-Core recommendation.
4.1
Interface Node
Names
4.1.1 EXPORT SPEC const DOMString
ixmlNode getNodeName (IXML Node* nodeptr )
Returns the name of the Node, depend-
ing on what type of Node it is, in a read-
only string. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.1.2 EXPORT SPEC DOMString
ixmlNode getNodeValue (IXML Node* nodeptr )
Returns the value of the Node as a string.
........................................ 10
4.1.3 EXPORT SPEC int
ixmlNode setNodeValue (IXML Node* nodeptr,
char* newNodeValue )
Assigns a new value to a Node. . . . . . . . 10
4.1.4 EXPORT SPEC unsigned short
ixmlNode getNodeType (IXML Node* nodeptr )
Retrieves the type of a Node. ......... 11
4.1.5 EXPORT SPEC IXML Node*
ixmlNode getParentNode (IXML Node* nodeptr )
Retrieves the parent Node for a Node. 11
4.1.6 EXPORT SPEC IXML NodeList*
[Link]
July 4, 2006 7
4 DOM Interfaces
[Link]
July 4, 2006 8
4 DOM Interfaces
The Node interface forms the primary datatype for all other DOM objects. Every other interface
is derived from this interface, inheriting its functionality. For more information, refer to DOM2-
Core page 34.
4.1.1
Returns the name of the Node, depending on what type of Node it is, in a read-only string.
Returns the name of the Node, depending on what type of Node it is, in a read-only string.
Refer to the table in the DOM2-Core for a description of the node names for various interfaces.
[Link]
July 4, 2006 9
4 DOM Interfaces
4.1.2
Returns the value of the Node as a string. Note that this string is not a copy and modifying it
will modify the value of the Node.
4.1.3
Assigns a new value to a Node. The newNodeValue string is duplicated and stored in the
Node so that the original does not have to persist past this call.
[Link]
July 4, 2006 10
4 DOM Interfaces
4.1.4
• eATTRIBUTE NODE
• eCDATA SECTION NODE
• eCOMMENT NODE
• eDOCUMENT FRAGMENT NODE
• eDOCUMENT NODE
• eDOCUMENT TYPE NODE
• eELEMENT NODE
• eENTITY NODE
• eENTITY REFERENCE NODE
• eNOTATION NODE
• ePROCESSING INSTRUCTION NODE
• eTEXT NODE
4.1.5
[Link]
July 4, 2006 11
4 DOM Interfaces
4.1.6
Retrieves the list of children of a Node in a NodeList structure. If a Node has no children,
ixmlNode getChildNodes returns a NodeList structure that contains no Nodes.
4.1.7
Return Value: [Node*] A pointer to the first child Node or NULL if the
Node does not have any children.
Parameters: nodeptr The Node from which to retrieve the first child.
4.1.8
Return Value: [Node*] A pointer to the last child Node or NULL if the
Node does not have any children.
Parameters: nodeptr The Node from which to retrieve the last child.
[Link]
July 4, 2006 12
4 DOM Interfaces
4.1.9
4.1.10
4.1.11
[Link]
July 4, 2006 13
4 DOM Interfaces
4.1.12
Retrieves the document object associated with this Node. This owner document Node allows
other Nodes to be created in the context of this document. Note that Document nodes do not
have an owner document.
4.1.13
Retrieves the namespace URI for a Node as a DOMString. Only Nodes of type eELEMENT NODE
or eATTRIBUTE NODE can have a namespace URI. Nodes created through the Document interface
will only contain a namespace if created using ixmlDocument createElementNS.
4.1.14
Retrieves the namespace prefix, if present. The prefix is the name used as an alias for the names-
pace URI for this element. Only Nodes of type eELEMENT NODE or eATTRIBUTE NODE can have a
prefix. Nodes created through the Document interface will only contain a prefix if created using
ixmlDocument createElementNS.
[Link]
July 4, 2006 14
4 DOM Interfaces
4.1.15
Retrieves the local name of a Node, if present. The local name is the tag name without the
namespace prefix. Only Nodes of type eELEMENT NODE or eATTRIBUTE NODE can have a local
name. Nodes created through the Document interface will only contain a local name if created
using ixmlDocument createElementNS.
4.1.16
Inserts a new child Node before the existing child Node. refChild can be NULL, which inserts
newChild at the end of the list of children. Note that the Node (or Nodes) in newChild must
already be owned by the owner document (or have no owner at all) of nodeptr for insertion. If not,
the Node (or Nodes) must be imported into the document using ixmlDocument importNode.
If newChild is already in the tree, it is removed first.
[Link]
July 4, 2006 15
4 DOM Interfaces
4.1.17
Replaces an existing child Node with a new child Node in the list of children of a Node.
Parameters: nodeptr The parent of the Node which contains the child
to replace.
newChild The child with which to replace oldChild.
oldChild The child to replace with newChild.
returnNode Pointer to a Node to place the removed old-
Child Node.
[Link]
July 4, 2006 16
4 DOM Interfaces
4.1.18
Removes a child from the list of children of a Node. returnNode will contain the oldChild
Node, appropriately removed from the tree (i.e. it will no longer have an owner document).
4.1.19
Appends a child Node to the list of children of a Node. If newChild is already in the tree, it is
removed first.
[Link]
July 4, 2006 17
4 DOM Interfaces
4.1.20
Return Value: [BOOL] TRUE if the Node has one or more children oth-
erwise FALSE.
Parameters: nodeptr The Node to query for children.
4.1.21
Clones a Node.
Clones a Node. The new Node does not have a parent. The deep parameter controls whether
the subtree of the Node is also cloned. For details on cloning specific types of Nodes, refer to
the DOM2-Core recommendation.
[Link]
July 4, 2006 18
4 DOM Interfaces
4.1.22
Queries whether this Node has attributes. Note that only Element nodes have attributes.
Return Value: [BOOL] TRUE if the Node has attributes otherwise FALSE.
Parameters: node The Node to query for attributes.
4.1.23
4.2
Interface Attr
Names
4.2.1 EXPORT SPEC void
ixmlAttr free (IXML Attr* attrNode )
Frees an Attr node. . . . . . . . . . . . . . . . . . . . 20
The Attr interface represents an attribute of an Element. The document type definition (DTD)
or schema usually dictate the allowable attributes and values for a particular element. For more
information, refer to the Interface Attr section in the DOM2-Core.
[Link]
July 4, 2006 19
4 DOM Interfaces
4.2.1
4.3
Interface CDATASection
Names
4.3.1 EXPORT SPEC void
ixmlCDATASection init (IXML CDATASection* nodeptr )
Initializes a CDATASection node. . . . 20
4.3.2 EXPORT SPEC void
ixmlCDATASection free (IXML CDATASection* nodeptr )
Frees a CDATASection node. . . . . . . . . 21
The CDATASection is used to escape blocks of text containing characters that would otherwise
be regarded as markup. CDATA sections cannot be nested. Their primary purpose is for including
material such XML fragments, without needing to escape all the delimiters. For more information,
refer to the Interface CDATASection section in the DOM2-Core.
4.3.1
[Link]
July 4, 2006 20
4 DOM Interfaces
4.3.2
4.4
Interface Document
Names
4.4.1 EXPORT SPEC void
ixmlDocument init (IXML Document* nodeptr )
Initializes a Document node. . . . . . . . . . 24
4.4.2 EXPORT SPEC int
ixmlDocument createDocumentEx (IXML Document** doc
)
Creates a new empty Document node. 24
4.4.3 EXPORT SPEC IXML Document*
ixmlDocument createDocument ()
Creates a new empty Document node. 25
4.4.4 EXPORT SPEC int
ixmlDocument createElementEx (IXML Document* doc,
const DOMString
tagName,
IXML Element**
rtElement )
Creates a new Element node with the
given tag name. . . . . . . . . . . . . . . . . . . . . . . . 25
4.4.5 EXPORT SPEC IXML Element*
ixmlDocument createElement (IXML Document* doc,
const DOMString tagName )
Creates a new Element node with the
given tag name. . . . . . . . . . . . . . . . . . . . . . . . 26
4.4.6 EXPORT SPEC int
[Link]
July 4, 2006 21
4 DOM Interfaces
[Link]
July 4, 2006 22
4 DOM Interfaces
[Link]
July 4, 2006 23
4 DOM Interfaces
The Document interface represents the entire XML document. In essence, it is the root of the
document tree and provides the primary interface to the elements of the document. For more
information, refer to the Interface Document section in the DOM2Core.
4.4.1
4.4.2
Creates a new empty Document node. The ixmlDocument createDocumentEx API differs
from the ixmlDocument createDocument API in that it returns an error code describing the
reason for the failure rather than just NULL.
[Link]
July 4, 2006 24
4 DOM Interfaces
4.4.3
4.4.4
Creates a new Element node with the given tag name. The new Element node has a nodeName
of tagName and the localName, prefix, and namespaceURI set to NULL. To create an Element
with a namespace, see ixmlDocument createElementNS.
The ixmlDocument createElementEx API differs from the ixmlDocu-
ment createElement API in that it returns an error code describing the reason for failure
rather than just NULL.
[Link]
July 4, 2006 25
4 DOM Interfaces
4.4.5
Creates a new Element node with the given tag name. The new Element node has a nodeName
of tagName and the localName, prefix, and namespaceURI set to NULL. To create an Element
with a namespace, see ixmlDocument createElementNS.
4.4.6
Creates a new Text node with the given data. The ixmlDocument createTextNodeEx API
differs from the ixmlDocument createTextNode API in that it returns an error code describing
the reason for failure rather than just NULL.
[Link]
July 4, 2006 26
4 DOM Interfaces
4.4.7
4.4.8
[Link]
July 4, 2006 27
4 DOM Interfaces
4.4.9
4.4.10
4.4.11
[Link]
July 4, 2006 28
4 DOM Interfaces
4.4.12
Returns a NodeList of all Elements that match the given tag name in the order in which they
were encountered in a preorder traversal of the Document tree.
Returns a NodeList of all Elements that match the given tag name in the order in which they
were encountered in a preorder traversal of the Document tree.
4.4.13
Creates a new Element node in the given qualified name and namespace URI.
Creates a new Element node in the given qualified name and namespace URI.
The ixmlDocument createElementNSEx API differs from the ixmlDocu-
ment createElementNS API in that it returns an error code describing the reason for
failure rather than just NULL.
[Link]
July 4, 2006 29
4 DOM Interfaces
4.4.14
Creates a new Element node in the given qualified name and namespace URI.
Creates a new Element node in the given qualified name and namespace URI.
4.4.15
Creates a new Attr node with the given qualified name and namespace URI.
Creates a new Attr node with the given qualified name and namespace URI.
The ixmlDocument createAttributeNSEx API differs from the ixmlDocu-
ment createAttributeNS API in that it returns an error code describing the reason for
failure rather than just NULL.
[Link]
July 4, 2006 30
4 DOM Interfaces
4.4.16
Creates a new Attr node with the given qualified name and namespace URI.
Creates a new Attr node with the given qualified name and namespace URI.
4.4.17
Returns a NodeList of Elements that match the given local name and namespace URI in the
order they are encountered in a preorder traversal of the Document tree.
Returns a NodeList of Elements that match the given local name and namespace URI in the
order they are encountered in a preorder traversal of the Document tree. Either namespaceURI
or localName can be the special "*" character, which matches any namespace or any local name
respectively.
[Link]
July 4, 2006 31
4 DOM Interfaces
4.4.18
4.4.19
Frees a Document object and all Nodes associated with it. Any Nodes extracted via any other
interface function, e.g. ixmlDocument GetElementById, become invalid after this call unless
explicitly cloned.
4.4.20
[Link]
July 4, 2006 32
4 DOM Interfaces
Imports a Node from another Document into this Document. The new Node does not a have
parent node: it is a clone of the original Node with the ownerDocument set to doc. The deep
parameter controls whether all the children of the Node are imported. Refer to the DOM2-Core
recommendation for details on importing specific node types.
4.5
Interface Element
Names
4.5.1 EXPORT SPEC void
ixmlElement init (IXML Element* element )
Initializes a IXML Element node. ... 36
4.5.2 EXPORT SPEC const DOMString
ixmlElement getTagName (IXML Element* element )
Returns the name of the tag as a constant
string. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.5.3 EXPORT SPEC DOMString
ixmlElement getAttribute (IXML Element* element,
DOMString name )
Retrieves an attribute of an Element by
name. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.5.4 EXPORT SPEC int
ixmlElement setAttribute (IXML Element* element,
DOMString name,
DOMString value )
Adds a new attribute to an Element. . . 37
4.5.5 EXPORT SPEC int
[Link]
July 4, 2006 33
4 DOM Interfaces
[Link]
July 4, 2006 34
4 DOM Interfaces
The Element interface represents an element in an XML document. Only Elements are allowed
to have attributes, which are stored in the attributes member of a Node. The Element interface
extends the Node interface and adds more operations to manipulate attributes.
4.5.1
[Link]
July 4, 2006 35
4 DOM Interfaces
4.5.2
4.5.3
4.5.4
[Link]
July 4, 2006 36
4 DOM Interfaces
Adds a new attribute to an Element. If an attribute with the same name already exists, the
attribute value will be updated with the new value in value.
4.5.5
[Link]
July 4, 2006 37
4 DOM Interfaces
4.5.6
4.5.7
Adds a new attribute node to an Element. If an attribute already exists with newAttr as a
name, it will be replaced with the new one and the old one will be returned in rtAttr.
[Link]
July 4, 2006 38
4 DOM Interfaces
4.5.8
4.5.9
Returns a NodeList of all descendant Elements with a given tag name, in the order in which
they are encountered in a pre-order traversal of this Element tree.
Returns a NodeList of all descendant Elements with a given tag name, in the order in which
they are encountered in a pre-order traversal of this Element tree.
[Link]
July 4, 2006 39
4 DOM Interfaces
4.5.10
Retrieves an attribute value using the local name and namespace URI.
Retrieves an attribute value using the local name and namespace URI.
4.5.11
Adds a new attribute to an Element using the local name and namespace URI.
Adds a new attribute to an Element using the local name and namespace URI. If another attribute
matches the same local name and namespace, the prefix is changed to be the prefix part of the
qualifiedName and the value is changed to value.
[Link]
July 4, 2006 40
4 DOM Interfaces
4.5.12
Parameters: element The Element from which to remove the the at-
tribute.
namespaceURI The namespace URI of the attribute.
localName The local name of the attribute.
4.5.13
[Link]
July 4, 2006 41
4 DOM Interfaces
4.5.14
Adds a new attribute node. If an attribute with the same local name and namespace URI already
exists in the Element, the existing attribute node is replaced with newAttr and the old returned
in rcAttr.
4.5.15
Returns a NodeList of all descendant Elements with a given tag name, in the order in which
they are encountered in the pre-order traversal of the Element tree.
Returns a NodeList of all descendant Elements with a given tag name, in the order in which
they are encountered in the pre-order traversal of the Element tree.
[Link]
July 4, 2006 42
4 DOM Interfaces
4.5.16
Queries whether the Element has an attribute with the given name or a default value.
Queries whether the Element has an attribute with the given name or a default value.
Return Value: [BOOL] TRUE if the Element has an attribute with this
name or has a default value for that attribute,
otherwise FALSE.
Parameters: element The Element on which to check for an attribute.
name The name of the attribute for which to check.
4.5.17
Queries whether the Element has an attribute with the given local name and namespace URI or
has a default value for that attribute.
Queries whether the Element has an attribute with the given local name and namespace URI or
has a default value for that attribute.
Return Value: [BOOL] TRUE if the Element has an attribute with the
given namespace and local name or has a default
value for that attribute, otherwise FALSE.
Parameters: element The Element on which to check for the at-
tribute.
namespaceURI The namespace URI of the attribute.
localName The local name of the attribute.
4.5.18
[Link]
July 4, 2006 43
4 DOM Interfaces
4.6
Interface NamedNodeMap
Names
4.6.1 EXPORT SPEC unsigned long
ixmlNamedNodeMap getLength (IXML NamedNodeMap*
nnMap )
Returns the number of items contained in
this NamedNodeMap. . . . . . . . . . . . . . . . 45
4.6.2 EXPORT SPEC IXML Node*
ixmlNamedNodeMap getNamedItem
(IXML NamedNodeMap*
nnMap,
DOMString name )
Retrieves a Node from the
NamedNodeMap by name. . . . . . . . . . . 46
4.6.3 EXPORT SPEC IXML Node*
ixmlNamedNodeMap setNamedItem
(IXML NamedNodeMap*
nnMap,
IXML Node* arg )
Adds a new Node to the
NamedNodeMap using the Node
name attribute. . . . . . . . . . . . . . . . . . . . . . . . . 46
4.6.4 EXPORT SPEC IXML Node*
ixmlNamedNodeMap removeNamedItem
(IXML NamedNodeMap*
nnMap,
DOMString
name )
Removes a Node from a
NamedNodeMap specified by name. . 47
4.6.5 EXPORT SPEC IXML Node*
ixmlNamedNodeMap item (IXML NamedNodeMap* nnMap,
unsigned long index )
Retrieves a Node from a
NamedNodeMap specified by a nu-
merical index. . . . . . . . . . . . . . . . . . . . . . . . . . 47
4.6.6 EXPORT SPEC IXML Node*
[Link]
July 4, 2006 44
4 DOM Interfaces
ixmlNamedNodeMap getNamedItemNS
(IXML NamedNodeMap*
nnMap,
DOMString*
namespaceURI,
DOMString
localName )
Retrieves a Node from a
NamedNodeMap specified by names-
pace URI and local name. . . . . . . . . . . . . . . 47
4.6.7 EXPORT SPEC IXML Node*
ixmlNamedNodeMap setNamedItemNS
(IXML NamedNodeMap*
nnMap,
IXML Node* arg
)
Adds a new Node to the
NamedNodeMap using the Node
local name and namespace URI attributes.
........................................ 48
4.6.8 EXPORT SPEC IXML Node*
ixmlNamedNodeMap removeNamedItemNS
(IXML NamedNodeMap*
nnMap,
DOMString
names-
paceURI,
DOMString
localName )
Removes a Node from a
NamedNodeMap specified by names-
pace URI and local name. . . . . . . . . . . . . . . 48
4.6.9 EXPORT SPEC void
ixmlNamedNodeMap free (IXML NamedNodeMap* nnMap )
Frees a NamedNodeMap. . . . . . . . . . . . 48
4.6.1
[Link]
July 4, 2006 45
4 DOM Interfaces
4.6.2
4.6.3
Adds a new Node to the NamedNodeMap using the Node name attribute.
Adds a new Node to the NamedNodeMap using the Node name attribute.
Return Value: [Node*] The old Node if the new Node replaces
it or NULL if the Node was not in the
NamedNodeMap before.
Parameters: nnMap The NamedNodeMap in which to add the new
Node.
arg The new Node to add to the
NamedNodeMap.
4.6.4
[Link]
July 4, 2006 46
4 DOM Interfaces
4.6.5
4.6.6
Retrieves a Node from a NamedNodeMap specified by namespace URI and local name.
Retrieves a Node from a NamedNodeMap specified by namespace URI and local name.
[Link]
July 4, 2006 47
4 DOM Interfaces
4.6.7
Adds a new Node to the NamedNodeMap using the Node local name and namespace URI
attributes.
Adds a new Node to the NamedNodeMap using the Node local name and namespace URI
attributes.
Return Value: [Node*] The old Node if the new Node replaces
it or NULL if the Node was not in the
NamedNodeMap before.
Parameters: nnMap The NamedNodeMap in which to add the
Node.
arg The Node to add to the map.
4.6.8
Removes a Node from a NamedNodeMap specified by namespace URI and local name.
Removes a Node from a NamedNodeMap specified by namespace URI and local name.
4.6.9
Frees a NamedNodeMap.
Frees a NamedNodeMap. The Nodes inside the map are not freed, just the NamedNodeMap
object.
[Link]
July 4, 2006 48
4 DOM Interfaces
4.7
Interface NodeList
Names
4.7.1 EXPORT SPEC IXML Node*
ixmlNodeList item (IXML NodeList* nList,
unsigned long index )
Retrieves a Node from a NodeList spec-
ified by a numerical index. . . . . . . . . . . . . . 49
4.7.2 EXPORT SPEC unsigned long
ixmlNodeList length (IXML NodeList* nList )
Returns the number of Nodes in a
NodeList. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.7.3 EXPORT SPEC void
ixmlNodeList free (IXML NodeList* nList )
Frees a NodeList object. . . . . . . . . . . . . . . 50
The NodeList interface abstracts an ordered collection of nodes. Note that changes to the
underlying nodes will change the nodes contained in a NodeList. The DOM2-Core refers to this
as being live.
4.7.1
[Link]
July 4, 2006 49
4 DOM Interfaces
4.7.2
4.7.3
Frees a NodeList object. Since the underlying Nodes are references, they are not freed using
this operating. This only frees the NodeList object.
[Link]
July 4, 2006 50
5 IXML API
IXML API
Names
5.1 DOMString ixmlPrintDocument (IXML Document* doc)
Renders a Node and all sub-elements into
an XML document representation. . . . . . 52
5.2 DOMString ixmlPrintNode (IXML Node* doc )
Renders a Node and all sub-elements into
an XML text representation. . . . . . . . . . . . 52
5.3 DOMString ixmlDocumenttoString (IXML Document* doc)
Renders a Node and all sub-elements into
an XML document representation. . . . . . 53
5.4 EXPORT SPEC DOMString
ixmlNodetoString (IXML Node* doc )
Renders a Node and all sub-elements into
an XML text representation. . . . . . . . . . . . 53
5.5 void ixmlRelaxParser (char errorChar)
Makes the XML parser more tolerant to
malformed text. . . . . . . . . . . . . . . . . . . . . . . . . 53
5.6 EXPORT SPEC IXML Document*
ixmlParseBuffer (char* buffer )
Parses an XML text buffer converting it
into an IXML DOM representation. . . . 54
5.7 EXPORT SPEC int
ixmlParseBufferEx (char* buffer, IXML Document** doc )
Parses an XML text buffer converting it
into an IXML DOM representation. . . . 54
5.8 EXPORT SPEC IXML Document*
ixmlLoadDocument (char* xmlFile )
Parses an XML text file converting it into
an IXML DOM representation. . . . . . . . . 55
5.9 EXPORT SPEC int
ixmlLoadDocumentEx (char* xmlFile,
IXML Document** doc )
Parses an XML text file converting it into
an IXML DOM representation. . . . . . . . . 55
5.10 EXPORT SPEC DOMString
ixmlCloneDOMString (const DOMString src )
Clones an existing DOMString. . . . . . . 56
5.11 EXPORT SPEC void
ixmlFreeDOMString (DOMString buf )
Frees a DOMString. ................. 56
The IXML API contains utility functions that are not part of the standard DOM interfaces. They
include functions to create a DOM structure from a file or buffer, create an XML file from a DOM
[Link]
July 4, 2006 51
5 IXML API
5.1
Renders a Node and all sub-elements into an XML document representation. The caller is required
to free the DOMString returned from this function using ixmlFreeDOMString when it is no
longer required.
Note that this function can be used for any Node-derived interface. The difference between
ixmlPrintDocument and ixmlPrintNode is ixmlPrintDocument includes the XML prolog
while ixmlPrintNode only produces XML elements. An XML document is not well formed
unless it includes the prolog and at least one element.
This function introduces lots of white space to print the DOMString in readable format.
5.2
Renders a Node and all sub-elements into an XML text representation. The caller is required
to free the DOMString returned from this function using ixmlFreeDOMString when it is no
longer required.
Note that this function can be used for any Node-derived interface. A similar ixmlPrint-
Document function is defined to avoid casting when printing whole documents. This function
introduces lots of white space to print the DOMString in readable format.
[Link]
July 4, 2006 52
5 IXML API
5.3
Renders a Node and all sub-elements into an XML document representation. The caller is required
to free the DOMString returned from this function using ixmlFreeDOMString when it is no
longer required.
Note that this function can be used for any Node-derived interface. The difference be-
tween ixmlDocumenttoString and ixmlNodetoString is ixmlDocumenttoString includes
the XML prolog while ixmlNodetoString only produces XML elements. An XML document is
not well formed unless it includes the prolog and at least one element.
5.4
Renders a Node and all sub-elements into an XML text representation. The caller is required
to free the DOMString returned from this function using ixmlFreeDOMString when it is no
longer required.
Note that this function can be used for any Node-derived interface. The difference between
ixmlNodetoString and ixmlDocumenttoString is ixmlNodetoString does not include the
XML prolog, it only produces XML elements.
5.5
[Link]
July 4, 2006 53
5 IXML API
If errorChar is 0 (default), the parser is strict about XML encoding : invalid UTF-8 sequences
or ”&” entities are rejected, and the parsing aborts. If errorChar is not 0, the parser is relaxed
: invalid UTF-8 characters are replaced by the errorChar, and invalid ”&” entities are left
untranslated. The parsing is then allowed to continue.
5.6
5.7
Parameters: buffer The buffer that contains the XML text to convert
to a Document.
doc A point to store the Document if file correctly
parses or NULL on an error.
[Link]
July 4, 2006 54
5 IXML API
5.8
5.9
[Link]
July 4, 2006 55
5 IXML API
5.10
5.11
Frees a DOMString.
Frees a DOMString.
[Link]
July 4, 2006 56