64 if (nodeptr != NULL) {
65 nodeptr->ownerDocument = doc;
73 unsigned short nodeType;
78 if (doc == NULL || importNode == NULL) {
79 return IXML_INVALID_PARAMETER;
83 if (nodeType == eDOCUMENT_NODE) {
84 return IXML_NOT_SUPPORTED_ERR;
88 if (newNode == NULL) {
100 int errCode = IXML_SUCCESS;
103 if (doc == NULL || tagName == NULL) {
104 errCode = IXML_INVALID_PARAMETER;
109 if (newElement == NULL) {
110 errCode = IXML_INSUFFICIENT_MEMORY;
115 newElement->tagName = strdup(tagName);
116 if (newElement->tagName == NULL) {
119 errCode = IXML_INSUFFICIENT_MEMORY;
123 newElement->n.nodeType = eELEMENT_NODE;
124 newElement->n.nodeName = strdup(tagName);
125 if (newElement->n.nodeName == NULL) {
126 free(newElement->tagName);
129 errCode = IXML_INSUFFICIENT_MEMORY;
133 newElement->n.ownerDocument = doc;
136 *rtElement = newElement;
144 int ret = IXML_SUCCESS;
147 if (ret != IXML_SUCCESS) {
148 IxmlPrintf(__FILE__, __LINE__,
"ixmlDocument_createElement",
157 int errCode = IXML_SUCCESS;
162 errCode = IXML_INSUFFICIENT_MEMORY;
169 if (doc->n.nodeName == NULL) {
172 errCode = IXML_INSUFFICIENT_MEMORY;
176 doc->n.nodeType = eDOCUMENT_NODE;
177 doc->n.ownerDocument = doc;
195 int rc = IXML_SUCCESS;
198 if (doc == NULL || data == NULL) {
199 rc = IXML_INVALID_PARAMETER;
204 if (returnNode == NULL) {
205 rc = IXML_INSUFFICIENT_MEMORY;
211 returnNode->nodeName = strdup((
const char*)
TEXTNODENAME);
212 if (returnNode->nodeName == NULL) {
215 rc = IXML_INSUFFICIENT_MEMORY;
220 returnNode->nodeValue = strdup(data);
221 if (returnNode->nodeValue == NULL) {
224 rc = IXML_INSUFFICIENT_MEMORY;
229 returnNode->nodeType = eTEXT_NODE;
230 returnNode->ownerDocument = doc;
233 *textNode = returnNode;
249 int errCode = IXML_SUCCESS;
252 if (attrNode == NULL) {
253 errCode = IXML_INSUFFICIENT_MEMORY;
257 if (doc == NULL || name == NULL) {
260 errCode = IXML_INVALID_PARAMETER;
265 attrNode->n.nodeType = eATTRIBUTE_NODE;
268 attrNode->n.nodeName = strdup(name);
269 if (attrNode->n.nodeName == NULL) {
272 errCode = IXML_INSUFFICIENT_MEMORY;
276 attrNode->n.ownerDocument = doc;
298 int errCode = IXML_SUCCESS;
300 if (doc == NULL || namespaceURI == NULL || qualifiedName == NULL) {
301 errCode = IXML_INVALID_PARAMETER;
306 if (errCode != IXML_SUCCESS) {
310 attrNode->n.namespaceURI = strdup(namespaceURI);
311 if (attrNode->n.namespaceURI == NULL) {
314 errCode = IXML_INSUFFICIENT_MEMORY;
319 if (errCode != IXML_SUCCESS) {
343 int errCode = IXML_SUCCESS;
346 if (doc == NULL || data == NULL) {
347 errCode = IXML_INVALID_PARAMETER;
352 if (cDSectionNode == NULL) {
353 errCode = IXML_INSUFFICIENT_MEMORY;
358 cDSectionNode->n.nodeType = eCDATA_SECTION_NODE;
359 cDSectionNode->n.nodeName = strdup((
const char*)
CDATANODENAME);
360 if (cDSectionNode->n.nodeName == NULL) {
362 cDSectionNode = NULL;
363 errCode = IXML_INSUFFICIENT_MEMORY;
367 cDSectionNode->n.nodeValue = strdup(data);
368 if (cDSectionNode->n.nodeValue == NULL) {
370 cDSectionNode = NULL;
371 errCode = IXML_INSUFFICIENT_MEMORY;
375 cDSectionNode->n.ownerDocument = doc;
378 *rtCD = cDSectionNode;
388 return cDSectionNode;
396 int ret = IXML_SUCCESS;
399 if (doc == NULL || namespaceURI == NULL || qualifiedName == NULL) {
401 ret = IXML_INVALID_PARAMETER;
406 if (ret != IXML_SUCCESS) {
411 newElement->n.namespaceURI = strdup(namespaceURI);
412 if (newElement->n.namespaceURI == NULL) {
416 ret = IXML_INSUFFICIENT_MEMORY;
421 if (ret != IXML_SUCCESS) {
425 ret = IXML_INSUFFICIENT_MEMORY;
429 newElement->n.nodeValue = NULL;
432 *rtElement = newElement;
433 if (ret != IXML_SUCCESS) {
434 IxmlPrintf(__FILE__, line,
"ixmlDocument_createElementNSEx",
456 if (doc == NULL || tagName == NULL) {
462 return returnNodeList;
470 if (doc == NULL || namespaceURI == NULL || localName == NULL) {
477 return returnNodeList;
486 if (nodeptr == NULL || tagName == NULL) {
496 if (strcmp(tagName, name) == 0) {
502 if (rtElement == NULL) {
510 if (rtElement == NULL) {
static void ixmlDocument_setOwnerDocument(IXML_Document *doc, IXML_Node *nodeptr)
Data structure representing a CDATA section node.
Data structure common to all types of nodes.
Data structure representing an Attribute node.
Data structure representing a list of nodes.
Data structure representing an Element node.
Data structure representing the DOM Document.
IXML_Element * ixmlDocument_getElementById(IXML_Document *doc, const DOMString tagName)
Returns the Element whose ID matches that given id.
PUPNP_Api unsigned short ixmlNode_getNodeType(IXML_Node *nodeptr)
Retrieves the type of a Node. Note that not all possible return values are actually implemented.
int ixmlDocument_createTextNodeEx(IXML_Document *doc, const DOMString data, IXML_Node **textNode)
Creates a new Text node with the given data.
IXML_Element * ixmlDocument_createElementNS(IXML_Document *doc, const DOMString namespaceURI, const DOMString qualifiedName)
Creates a new Element node in the given qualified name and namespace URI.
IXML_Element * ixmlDocument_createElement(IXML_Document *doc, const DOMString tagName)
Creates a new Element node with the given tag name.
PUPNP_Api void ixmlAttr_free(IXML_Attr *attrNode)
Frees an Attr node.
IXML_CDATASection * ixmlDocument_createCDATASection(IXML_Document *doc, const DOMString data)
Creates a new CDATASection node with given data.
int ixmlDocument_createAttributeNSEx(IXML_Document *doc, const DOMString namespaceURI, const DOMString qualifiedName, IXML_Attr **rtAttr)
Creates a new Attr node with the given qualified name and namespace URI.
PUPNP_Api void ixmlCDATASection_init(IXML_CDATASection *nodeptr)
Initializes a CDATASection node.
int ixmlDocument_createAttributeEx(IXML_Document *doc, const DOMString name, IXML_Attr **rtAttr)
Creates a new Attr node with the given name.
#define DOMString
The type of DOM strings.
IXML_NodeList * ixmlDocument_getElementsByTagNameNS(IXML_Document *doc, const DOMString namespaceURI, const DOMString localName)
Returns a NodeList of Elements that match the given local name and namespace URI in the order they ar...
PUPNP_Api void ixmlNode_free(IXML_Node *nodeptr)
Frees a Node and all Nodes in its subtree.
PUPNP_Api void ixmlCDATASection_free(IXML_CDATASection *nodeptr)
Frees a CDATASection node.
IXML_Attr * ixmlDocument_createAttributeNS(IXML_Document *doc, const DOMString namespaceURI, const DOMString qualifiedName)
Creates a new Attribute node with the given qualified name and namespace URI.
PUPNP_Api IXML_Node * ixmlNode_cloneNode(IXML_Node *nodeptr, int deep)
Clones a Node.
IXML_Node * ixmlDocument_createTextNode(IXML_Document *doc, const DOMString data)
Creates a new Text node with the given data.
PUPNP_Api IXML_Node * ixmlNode_getNextSibling(IXML_Node *nodeptr)
Retrieves the sibling Node immediately following this Node.
PUPNP_Api void ixmlElement_init(IXML_Element *element)
Initializes a IXML_Element node.
IXML_NodeList * ixmlDocument_getElementsByTagName(IXML_Document *doc, const DOMString tagName)
Returns a NodeList of all Elements that match the given tag name in the order in which they were enco...
PUPNP_Api const DOMString ixmlNode_getNodeName(IXML_Node *nodeptr)
Returns the name of the Node, depending on what type of Node it is, in a read-only string.
void ixmlDocument_init(IXML_Document *doc)
Initializes a Document node.
#define CDATANODENAME
The type of the DOM node.
int ixmlDocument_createCDATASectionEx(IXML_Document *doc, const DOMString data, IXML_CDATASection **rtCD)
Creates a new CDATASection node with given data.
#define TEXTNODENAME
The type of the DOM node.
int ixmlDocument_createElementEx(IXML_Document *doc, const DOMString tagName, IXML_Element **rtElement)
Creates a new Element node with the given tag name.
int ixmlDocument_importNode(IXML_Document *doc, IXML_Node *importNode, int deep, IXML_Node **rtNode)
Imports a Node from another Document into this Document.
PUPNP_Api void ixmlElement_free(IXML_Element *element)
Frees the given Element and any subtree of the Element.
IXML_Document * ixmlDocument_createDocument()
Creates a new empty Document node.
#define DOCUMENTNODENAME
The type of the DOM node.
IXML_Attr * ixmlDocument_createAttribute(IXML_Document *doc, const DOMString name)
Creates a new Attr node with the given name.
PUPNP_Api IXML_Node * ixmlNode_getFirstChild(IXML_Node *nodeptr)
Retrieves the first child Node of a Node.
int ixmlDocument_createDocumentEx(IXML_Document **rtDoc)
Creates a new empty Document node.
int ixmlDocument_createElementNSEx(IXML_Document *doc, const DOMString namespaceURI, const DOMString qualifiedName, IXML_Element **rtElement)
Creates a new Element node in the given qualified name and namespace URI.
void ixmlDocument_free(IXML_Document *doc)
Frees a Document object and all Nodes associated with it.
Auxiliar routines to aid debugging.
void IxmlPrintf(const char *DbgFileName, int DbgLineNo, const char *FunctionName, const char *FmtStr,...)
Prints the debug statement either on the standard output or log file along with the information from ...
void ixmlNode_getElementsByTagName(IXML_Node *n, const char *tagname, IXML_NodeList **list)
Returns a nodeList of all descendant Elements with a given tagName, in the order in which they are en...
void ixmlNode_init(IXML_Node *nodeptr)
Intializes a node.
int ixmlNode_setNodeName(IXML_Node *node, const DOMString qualifiedName)
void ixmlAttr_init(IXML_Attr *attrNode)
ixmlAttr_init
void ixmlNode_getElementsByTagNameNS(IXML_Node *n, const char *namespaceURI, const char *localName, IXML_NodeList **list)
Returns a nodeList of all the descendant Elements with a given local name and namespace URI in the or...