libUPnP  1.6.17
Data Structures | Defines | Typedefs
ixml.h File Reference
#include "UpnpGlobal.h"
Include dependency graph for ixml.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _IXML_Node
 Data structure common to all types of nodes. More...
struct  _IXML_Document
 Data structure representing the DOM Document. More...
struct  _IXML_CDATASection
 Data structure representing a CDATA section node. More...
struct  _IXML_Element
 Data structure representing an Element node. More...
struct  _IXML_ATTR
 Data structure representing an Attribute node. More...
struct  _IXML_Text
 Data structure representing a Text node. More...
struct  _IXML_NodeList
 Data structure representing a list of nodes. More...
struct  _IXML_NamedNodeMap
 Data structure representing a list of named nodes. More...

Defines

#define DOMString   char *
 The type of DOM strings.
#define TRUE   1
#define FALSE   0
#define IN
#define OUT
#define INOUT

Typedefs

typedef int BOOL

Functions

Interface Node

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.

const char * ixmlNode_getNodeName (IXML_Node *nodeptr)
 Returns the name of the Node, depending on what type of Node it is, in a read-only string.
const char * ixmlNode_getNodeValue (IXML_Node *nodeptr)
 Returns the value of the Node as a string.
int ixmlNode_setNodeValue (IXML_Node *nodeptr, const char *newNodeValue)
 Assigns a new value to a Node.
unsigned short ixmlNode_getNodeType (IXML_Node *nodeptr)
 Retrieves the type of a Node.
IXML_NodeixmlNode_getParentNode (IXML_Node *nodeptr)
 Retrieves the parent Node for a Node.
IXML_NodeListixmlNode_getChildNodes (IXML_Node *nodeptr)
 Retrieves the list of children of a Node in a NodeList structure.
IXML_NodeixmlNode_getFirstChild (IXML_Node *nodeptr)
 Retrieves the first child Node of a Node.
IXML_NodeixmlNode_getLastChild (IXML_Node *nodeptr)
 Retrieves the last child Node of a Node.
IXML_NodeixmlNode_getPreviousSibling (IXML_Node *nodeptr)
 Retrieves the sibling Node immediately preceding this Node.
IXML_NodeixmlNode_getNextSibling (IXML_Node *nodeptr)
 Retrieves the sibling Node immediately following this Node.
IXML_NamedNodeMapixmlNode_getAttributes (IXML_Node *nodeptr)
 Retrieves the attributes of a Node, if it is an Element node, in a NamedNodeMap structure.
IXML_DocumentixmlNode_getOwnerDocument (IXML_Node *nodeptr)
 Retrieves the document object associated with this Node.
const char * ixmlNode_getNamespaceURI (IXML_Node *nodeptr)
 Retrieves the namespace URI for a Node as a DOMString.
const char * ixmlNode_getPrefix (IXML_Node *nodeptr)
 Retrieves the namespace prefix, if present.
const char * ixmlNode_getLocalName (IXML_Node *nodeptr)
 Retrieves the local name of a Node, if present.
int ixmlNode_insertBefore (IXML_Node *nodeptr, IXML_Node *newChild, IXML_Node *refChild)
 Inserts a new child Node before the existing child Node.
int ixmlNode_replaceChild (IXML_Node *nodeptr, IXML_Node *newChild, IXML_Node *oldChild, IXML_Node **returnNode)
 Replaces an existing child Node with a new child Node in the list of children of a Node.
int ixmlNode_removeChild (IXML_Node *nodeptr, IXML_Node *oldChild, IXML_Node **returnNode)
 Removes a child from the list of children of a Node.
int ixmlNode_appendChild (IXML_Node *nodeptr, IXML_Node *newChild)
 Appends a child Node to the list of children of a Node.
BOOL ixmlNode_hasChildNodes (IXML_Node *nodeptr)
 Queries whether or not a Node has children.
IXML_NodeixmlNode_cloneNode (IXML_Node *nodeptr, BOOL deep)
 Clones a Node.
BOOL ixmlNode_hasAttributes (IXML_Node *nodeptr)
 Queries whether this Node has attributes.
void ixmlNode_free (IXML_Node *nodeptr)
 Frees a Node and all Nodes in its subtree.
Interface Attr

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.

void ixmlAttr_free (IXML_Attr *attrNode)
 Frees an Attr node.
Interface CDATASection

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.

void ixmlCDATASection_init (IXML_CDATASection *nodeptr)
 Initializes a CDATASection node.
void ixmlCDATASection_free (IXML_CDATASection *nodeptr)
 Frees a CDATASection node.
Interface Document

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.

void ixmlDocument_init (IXML_Document *nodeptr)
 Initializes a Document node.
int ixmlDocument_createDocumentEx (IXML_Document **doc)
 Creates a new empty Document node.
IXML_DocumentixmlDocument_createDocument (void)
 Creates a new empty Document node.
int ixmlDocument_createElementEx (IXML_Document *doc, const char *tagName, IXML_Element **rtElement)
 Creates a new Element node with the given tag name.
IXML_ElementixmlDocument_createElement (IXML_Document *doc, const char *tagName)
 Creates a new Element node with the given tag name.
int ixmlDocument_createTextNodeEx (IXML_Document *doc, const char *data, IXML_Node **textNode)
 Creates a new Text node with the given data.
IXML_NodeixmlDocument_createTextNode (IXML_Document *doc, const char *data)
 Creates a new Text node with the given data.
int ixmlDocument_createCDATASectionEx (IXML_Document *doc, const char *data, IXML_CDATASection **cdNode)
 Creates a new CDATASection node with given data.
IXML_CDATASectionixmlDocument_createCDATASection (IXML_Document *doc, const char *data)
 Creates a new CDATASection node with given data.
IXML_AttrixmlDocument_createAttribute (IXML_Document *doc, const char *name)
 Creates a new Attr node with the given name.
int ixmlDocument_createAttributeEx (IXML_Document *doc, const char *name, IXML_Attr **attrNode)
 Creates a new Attr node with the given name.
IXML_NodeListixmlDocument_getElementsByTagName (IXML_Document *doc, const char *tagName)
 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.
int ixmlDocument_createElementNSEx (IXML_Document *doc, const char *namespaceURI, const char *qualifiedName, IXML_Element **rtElement)
 Creates a new Element node in the given qualified name and namespace URI.
IXML_ElementixmlDocument_createElementNS (IXML_Document *doc, const char *namespaceURI, const char *qualifiedName)
 Creates a new Element node in the given qualified name and namespace URI.
int ixmlDocument_createAttributeNSEx (IXML_Document *doc, const char *namespaceURI, const char *qualifiedName, IXML_Attr **attrNode)
 Creates a new Attr node with the given qualified name and namespace URI.
IXML_AttrixmlDocument_createAttributeNS (IXML_Document *doc, const char *namespaceURI, const char *qualifiedName)
 Creates a new Attribute node with the given qualified name and namespace URI.
IXML_NodeListixmlDocument_getElementsByTagNameNS (IXML_Document *doc, const char *namespaceURI, const char *localName)
 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.
IXML_ElementixmlDocument_getElementById (IXML_Document *doc, const char *tagName)
 Returns the Element whose ID matches that given id.
void ixmlDocument_free (IXML_Document *doc)
 Frees a Document object and all Nodes associated with it.
int ixmlDocument_importNode (IXML_Document *doc, IXML_Node *importNode, BOOL deep, IXML_Node **rtNode)
 Imports a Node from another Document into this Document.
Interface Element

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.

void ixmlElement_init (IXML_Element *element)
 Initializes a IXML_Element node.
const char * ixmlElement_getTagName (IXML_Element *element)
 Returns the name of the tag as a constant string.
const char * ixmlElement_getAttribute (IXML_Element *element, const char *name)
 Retrieves an attribute of an Element by name.
int ixmlElement_setAttribute (IXML_Element *element, const char *name, const char *value)
 Adds a new attribute to an Element.
int ixmlElement_removeAttribute (IXML_Element *element, const char *name)
 Removes an attribute value by name. The attribute node is not removed.
IXML_AttrixmlElement_getAttributeNode (IXML_Element *element, const char *name)
 Retrieves an attribute node by name. See ixmlElement_getAttributeNodeNS to retrieve an attribute node using a qualified name or namespace URI.
int ixmlElement_setAttributeNode (IXML_Element *element, IXML_Attr *newAttr, IXML_Attr **rtAttr)
 Adds a new attribute node to an Element.
int ixmlElement_removeAttributeNode (IXML_Element *element, IXML_Attr *oldAttr, IXML_Attr **rtAttr)
 Removes the specified attribute node from an Element.
IXML_NodeListixmlElement_getElementsByTagName (IXML_Element *element, const char *tagName)
 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.
const char * ixmlElement_getAttributeNS (IXML_Element *element, const char *namespaceURI, const char *localname)
 Retrieves an attribute value using the local name and namespace URI.
int ixmlElement_setAttributeNS (IXML_Element *element, const char *namespaceURI, const char *qualifiedName, const char *value)
 Adds a new attribute to an Element using the local name and namespace URI.
int ixmlElement_removeAttributeNS (IXML_Element *element, const char *namespaceURI, const char *localName)
 Removes an attribute using the namespace URI and local name.
IXML_AttrixmlElement_getAttributeNodeNS (IXML_Element *element, const char *namespaceURI, const char *localName)
 Retrieves an Attr node by local name and namespace URI.
int ixmlElement_setAttributeNodeNS (IXML_Element *element, IXML_Attr *newAttr, IXML_Attr **rcAttr)
 Adds a new attribute node to the element node specified.
IXML_NodeListixmlElement_getElementsByTagNameNS (IXML_Element *element, const char *namespaceURI, const char *localName)
 Returns a NodeList of all descendant Elements with a given local name and namespace in the order in which they are encountered in the pre-order traversal of the Element tree.
BOOL ixmlElement_hasAttribute (IXML_Element *element, const char *name)
 Queries whether the Element has an attribute with the given name or a default value.
BOOL ixmlElement_hasAttributeNS (IXML_Element *element, const char *namespaceURI, const char *localName)
 Queries whether the Element has an attribute with the given local name and namespace URI or has a default value for that attribute.
void ixmlElement_free (IXML_Element *element)
 Frees the given Element and any subtree of the Element.
Interface NamedNodeMap

A NamedNodeMap object represents a list of objects that can be accessed by name. A NamedNodeMap maintains the objects in no particular order. The Node interface uses a NamedNodeMap to maintain the attributes of a node.

unsigned long ixmlNamedNodeMap_getLength (IXML_NamedNodeMap *nnMap)
 Returns the number of items contained in this NamedNodeMap.
IXML_NodeixmlNamedNodeMap_getNamedItem (IXML_NamedNodeMap *nnMap, const char *name)
 Retrieves a Node from the NamedNodeMap by name.
IXML_NodeixmlNamedNodeMap_setNamedItem (IXML_NamedNodeMap *nnMap, IXML_Node *arg)
 Adds a new Node to the NamedNodeMap using the Node name attribute.
IXML_NodeixmlNamedNodeMap_removeNamedItem (IXML_NamedNodeMap *nnMap, const char *name)
 Removes a Node from a NamedNodeMap specified by name.
IXML_NodeixmlNamedNodeMap_item (IXML_NamedNodeMap *nnMap, unsigned long index)
 Retrieves the indexth item in the map. If index is greater than or equal to the number of nodes in this map, this returns NULL.
IXML_NodeixmlNamedNodeMap_getNamedItemNS (IXML_NamedNodeMap *nnMap, const char **namespaceURI, const char *localName)
 Retrieves a Node from a NamedNodeMap specified by namespace URI and local name.
IXML_NodeixmlNamedNodeMap_setNamedItemNS (IXML_NamedNodeMap *nnMap, IXML_Node *arg)
 Adds a new Node to the NamedNodeMap using the Node local name and namespace URI attributes.
IXML_NodeixmlNamedNodeMap_removeNamedItemNS (IXML_NamedNodeMap *nnMap, const char *namespaceURI, const char *localName)
 Removes a Node from a NamedNodeMap specified by namespace URI and local name.
void ixmlNamedNodeMap_free (IXML_NamedNodeMap *nnMap)
 Frees a NamedNodeMap.
Interface NodeList

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.

IXML_NodeixmlNodeList_item (IXML_NodeList *nList, unsigned long index)
 Retrieves a Node from a NodeList specified by a numerical index.
unsigned long ixmlNodeList_length (IXML_NodeList *nList)
 Returns the number of Nodes in a NodeList.
void ixmlNodeList_free (IXML_NodeList *nList)
 Frees a NodeList object.
IXML API

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 structure, and manipulate DOMString objects.

char * ixmlPrintDocument (IXML_Document *doc)
 Renders a Node and all sub-elements into an XML document representation.
char * ixmlPrintNode (IXML_Node *doc)
 Renders a Node and all sub-elements into an XML text representation.
char * ixmlDocumenttoString (IXML_Document *doc)
 Renders a Node and all sub-elements into an XML document representation.
char * ixmlNodetoString (IXML_Node *doc)
 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.
void ixmlRelaxParser (char errorChar)
 Makes the XML parser more tolerant to malformed text.
IXML_DocumentixmlParseBuffer (const char *buffer)
 Parses an XML text buffer converting it into an IXML DOM representation.
int ixmlParseBufferEx (const char *buffer, IXML_Document **doc)
 Parses an XML text buffer converting it into an IXML DOM representation.
IXML_DocumentixmlLoadDocument (const char *xmlFile)
 Parses an XML text file converting it into an IXML DOM representation.
int ixmlLoadDocumentEx (const char *xmlFile, IXML_Document **doc)
 Parses an XML text file converting it into an IXML DOM representation.
char * ixmlCloneDOMString (const char *src)
 Clones an existing DOMString.
void ixmlFreeDOMString (char *buf)
 Frees a DOMString.

DOM Interfaces

The Document Object Model consists of a set of objects and interfaces for accessing and manipulating 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.

#define DOCUMENTNODENAME   "#document"
#define TEXTNODENAME   "#text"
#define CDATANODENAME   "#cdata-section"
enum  IXML_NODE_TYPE {
  eINVALID_NODE = 0, eELEMENT_NODE = 1, eATTRIBUTE_NODE = 2, eTEXT_NODE = 3,
  eCDATA_SECTION_NODE = 4, eENTITY_REFERENCE_NODE = 5, eENTITY_NODE = 6, ePROCESSING_INSTRUCTION_NODE = 7,
  eCOMMENT_NODE = 8, eDOCUMENT_NODE = 9, eDOCUMENT_TYPE_NODE = 10, eDOCUMENT_FRAGMENT_NODE = 11,
  eNOTATION_NODE = 12
}
 The type of the DOM node. More...
enum  IXML_ERRORCODE {
  IXML_SUCCESS = 0, IXML_INDEX_SIZE_ERR = 1, IXML_DOMSTRING_SIZE_ERR = 2, IXML_HIERARCHY_REQUEST_ERR = 3,
  IXML_WRONG_DOCUMENT_ERR = 4, IXML_INVALID_CHARACTER_ERR = 5, IXML_NO_DATA_ALLOWED_ERR = 6, IXML_NO_MODIFICATION_ALLOWED_ERR = 7,
  IXML_NOT_FOUND_ERR = 8, IXML_NOT_SUPPORTED_ERR = 9, IXML_INUSE_ATTRIBUTE_ERR = 10, IXML_INVALID_STATE_ERR = 11,
  IXML_SYNTAX_ERR = 12, IXML_INVALID_MODIFICATION_ERR = 13, IXML_NAMESPACE_ERR = 14, IXML_INVALID_ACCESS_ERR = 15,
  IXML_NO_SUCH_FILE = 101, IXML_INSUFFICIENT_MEMORY = 102, IXML_FILE_DONE = 104, IXML_INVALID_PARAMETER = 105,
  IXML_FAILED = 106, IXML_INVALID_ITEM_NUMBER = 107
}
 Error codes returned by the XML API, see the DOM spec. More...
typedef struct _IXML_DocumentDocptr
typedef struct _IXML_NodeNodeptr
typedef struct _IXML_Node IXML_Node
 Data structure common to all types of nodes.
typedef struct _IXML_Document IXML_Document
 Data structure representing the DOM Document.
typedef struct _IXML_CDATASection IXML_CDATASection
 Data structure representing a CDATA section node.
typedef struct _IXML_Element IXML_Element
 Data structure representing an Element node.
typedef struct _IXML_ATTR IXML_Attr
 Data structure representing an Attribute node.
typedef struct _IXML_Text IXML_Text
 Data structure representing a Text node.
typedef struct _IXML_NodeList IXML_NodeList
 Data structure representing a list of nodes.
typedef struct _IXML_NamedNodeMap IXML_NamedNodeMap
 Data structure representing a list of named nodes.

Detailed Description