67 nodeptr->ownerDocument = doc;
75 unsigned short nodeType;
80 if (!doc || !importNode) {
81 return IXML_INVALID_PARAMETER;
85 if (nodeType == eDOCUMENT_NODE) {
86 return IXML_NOT_SUPPORTED_ERR;
102 int errCode = IXML_SUCCESS;
105 if (!doc || !tagName) {
106 errCode = IXML_INVALID_PARAMETER;
112 errCode = IXML_INSUFFICIENT_MEMORY;
117 newElement->tagName = strdup(tagName);
118 if (!newElement->tagName) {
121 errCode = IXML_INSUFFICIENT_MEMORY;
125 newElement->n.nodeType = eELEMENT_NODE;
126 newElement->n.nodeName = strdup(tagName);
127 if (!newElement->n.nodeName) {
128 free(newElement->tagName);
131 errCode = IXML_INSUFFICIENT_MEMORY;
135 newElement->n.ownerDocument = doc;
138 *rtElement = newElement;
146 int ret = IXML_SUCCESS;
149 if (ret != IXML_SUCCESS) {
150 IxmlPrintf(__FILE__, __LINE__,
"ixmlDocument_createElement",
159 int errCode = IXML_SUCCESS;
164 errCode = IXML_INSUFFICIENT_MEMORY;
171 if (!doc->n.nodeName) {
174 errCode = IXML_INSUFFICIENT_MEMORY;
178 doc->n.nodeType = eDOCUMENT_NODE;
179 doc->n.ownerDocument = doc;
198 int rc = IXML_SUCCESS;
202 rc = IXML_INVALID_PARAMETER;
208 rc = IXML_INSUFFICIENT_MEMORY;
214 returnNode->nodeName = strdup((
const char*)
TEXTNODENAME);
215 if (!returnNode->nodeName) {
218 rc = IXML_INSUFFICIENT_MEMORY;
223 returnNode->nodeValue = strdup(data);
224 if (!returnNode->nodeValue) {
227 rc = IXML_INSUFFICIENT_MEMORY;
232 returnNode->nodeType = eTEXT_NODE;
233 returnNode->ownerDocument = doc;
236 *textNode = returnNode;
251 int errCode = IXML_SUCCESS;
255 errCode = IXML_INVALID_PARAMETER;
260 errCode = IXML_INSUFFICIENT_MEMORY;
264 attrNode->n.nodeType = eATTRIBUTE_NODE;
266 attrNode->n.nodeName = strdup(name);
267 if (!attrNode->n.nodeName) {
270 errCode = IXML_INSUFFICIENT_MEMORY;
273 attrNode->n.ownerDocument = doc;
294 int errCode = IXML_SUCCESS;
297 if (!doc || !namespaceURI || !qualifiedName) {
298 errCode = IXML_INVALID_PARAMETER;
303 if (errCode != IXML_SUCCESS) {
307 attrNode->n.namespaceURI = strdup(namespaceURI);
308 if (!attrNode->n.namespaceURI) {
311 errCode = IXML_INSUFFICIENT_MEMORY;
316 if (errCode != IXML_SUCCESS) {
340 int errCode = IXML_SUCCESS;
344 errCode = IXML_INVALID_PARAMETER;
349 if (!cDSectionNode) {
350 errCode = IXML_INSUFFICIENT_MEMORY;
355 cDSectionNode->n.nodeType = eCDATA_SECTION_NODE;
356 cDSectionNode->n.nodeName = strdup((
const char*)
CDATANODENAME);
357 if (!cDSectionNode->n.nodeName) {
359 cDSectionNode = NULL;
360 errCode = IXML_INSUFFICIENT_MEMORY;
364 cDSectionNode->n.nodeValue = strdup(data);
365 if (!cDSectionNode->n.nodeValue) {
367 cDSectionNode = NULL;
368 errCode = IXML_INSUFFICIENT_MEMORY;
372 cDSectionNode->n.ownerDocument = doc;
375 *rtCD = cDSectionNode;
385 return cDSectionNode;
393 int ret = IXML_SUCCESS;
396 if (!doc || !namespaceURI || !qualifiedName) {
398 ret = IXML_INVALID_PARAMETER;
403 if (ret != IXML_SUCCESS) {
408 newElement->n.namespaceURI = strdup(namespaceURI);
409 if (!newElement->n.namespaceURI) {
413 ret = IXML_INSUFFICIENT_MEMORY;
418 if (ret != IXML_SUCCESS) {
422 ret = IXML_INSUFFICIENT_MEMORY;
426 newElement->n.nodeValue = NULL;
429 *rtElement = newElement;
430 if (ret != IXML_SUCCESS) {
431 IxmlPrintf(__FILE__, line,
"ixmlDocument_createElementNSEx",
453 if (!doc || !tagName) {
459 return returnNodeList;
467 if (!doc || !namespaceURI || !localName) {
474 return returnNodeList;
483 if (!nodeptr || !tagName) {
493 if (strcmp(tagName, name) == 0) {
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(void)
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...