git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@409 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez
2008-06-04 21:29:13 +00:00
parent e83ccbe4d0
commit 0e7e47d5bd
2 changed files with 432 additions and 614 deletions

View File

@@ -705,7 +705,7 @@ EXPORT_SPEC void ixmlCDATASection_free(
* \brief Initializes a \b Document node. * \brief Initializes a \b Document node.
*/ */
EXPORT_SPEC void ixmlDocument_init( EXPORT_SPEC void ixmlDocument_init(
/*! The \b Document node to initialize. */ /*! [in] The \b Document node to initialize. */
IXML_Document *nodeptr); IXML_Document *nodeptr);
@@ -722,14 +722,15 @@ EXPORT_SPEC void ixmlDocument_init(
* to complete this operation. * to complete this operation.
*/ */
EXPORT_SPEC int ixmlDocument_createDocumentEx( EXPORT_SPEC int ixmlDocument_createDocumentEx(
/*! Pointer to a \b Document where the new object will be stored. */ /*! [out] Pointer to a \b Document where the new object will be stored. */
IXML_Document **doc); IXML_Document **doc);
/*! /*!
* \brief Creates a new empty \b Document node. * \brief Creates a new empty \b Document node.
* *
* \return A pointer to the new \b Document or \c NULL on failure. * \return A pointer to the new \b Document object with the nodeName set to
* "#document" or \c NULL on failure.
*/ */
EXPORT_SPEC IXML_Document *ixmlDocument_createDocument(); EXPORT_SPEC IXML_Document *ixmlDocument_createDocument();
@@ -753,11 +754,11 @@ EXPORT_SPEC IXML_Document *ixmlDocument_createDocument();
* to complete this operation. * to complete this operation.
*/ */
EXPORT_SPEC int ixmlDocument_createElementEx( EXPORT_SPEC int ixmlDocument_createElementEx(
/*! The owner \b Document of the new node. */ /*! [in] The owner \b Document of the new node. */
IXML_Document *doc, IXML_Document *doc,
/*! The tag name of the new \b Element node. */ /*! [in] The tag name of the new \b Element node. */
const DOMString tagName, const DOMString tagName,
/*! Pointer to an \b Element where the new object will be stored. */ /*! [out] Pointer to an \b Element where the new object will be stored. */
IXML_Element **rtElement); IXML_Element **rtElement);
@@ -768,19 +769,21 @@ EXPORT_SPEC int ixmlDocument_createElementEx(
* \c localName, \c prefix, and \c namespaceURI set to \c NULL. To create an * \c localName, \c prefix, and \c namespaceURI set to \c NULL. To create an
* \b Element with a namespace, see \b ixmlDocument_createElementNS. * \b Element with a namespace, see \b ixmlDocument_createElementNS.
* *
* \return A pointer to the new \b Element or \c NULL on failure. * \return A pointer to the new \b Element object with the node name set to
* tagName, and localName, prefix and namespaceURI set to \c NULL, or \c NULL
* on failure.
*/ */
EXPORT_SPEC IXML_Element *ixmlDocument_createElement( EXPORT_SPEC IXML_Element *ixmlDocument_createElement(
/*! The owner \b Document of the new node. */ /*! [in] The owner \b Document of the new node. */
IXML_Document *doc, IXML_Document *doc,
/*! The tag name of the new \b Element node. */ /*! [in] The tag name of the new \b Element node (case-sensitive). */
const DOMString tagName); const DOMString tagName);
/*! /*!
* \brief Creates a new \b Text node with the given data. * \brief Creates a new \b Text node with the given data.
* *
* The \b ixmlDocument_createTextNodeEx API differs from the * The \b ixmlDocument_createTextNodeEx() API differs from the
* \b ixmlDocument_createTextNode API in that it returns an error code * \b ixmlDocument_createTextNode API in that it returns an error code
* describing the reason for failure rather than just \c NULL. * describing the reason for failure rather than just \c NULL.
* *
@@ -792,11 +795,12 @@ EXPORT_SPEC IXML_Element *ixmlDocument_createElement(
* to complete this operation. * to complete this operation.
*/ */
EXPORT_SPEC int ixmlDocument_createTextNodeEx( EXPORT_SPEC int ixmlDocument_createTextNodeEx(
/*! The owner \b Document of the new node. */ /*! [in] The owner \b Document of the new node. */
IXML_Document *doc, IXML_Document *doc,
/*! The data to associate with the new \b Text node. */ /*! [in] The data to associate with the new \b Text node.
* It is stored in nodeValue field.*/
const DOMString data, const DOMString data,
/*! A pointer to a \b Node where the new object will be stored. */ /*! [out] A pointer to a \b Node where the new object will be stored. */
IXML_Node **textNode); IXML_Node **textNode);
@@ -806,9 +810,10 @@ EXPORT_SPEC int ixmlDocument_createTextNodeEx(
* \return A pointer to the new \b Node or \c NULL on failure. * \return A pointer to the new \b Node or \c NULL on failure.
*/ */
EXPORT_SPEC IXML_Node *ixmlDocument_createTextNode( EXPORT_SPEC IXML_Node *ixmlDocument_createTextNode(
/*! The owner \b Document of the new node. */ /*! [in] The owner \b Document of the new node. */
IXML_Document *doc, IXML_Document *doc,
/*! The data to associate with the new \b Text node. */ /*! [in] The data to associate with the new \b Text node. It is stored in
* the nodeValue field. */
const DOMString data); const DOMString data);
@@ -827,11 +832,11 @@ EXPORT_SPEC IXML_Node *ixmlDocument_createTextNode(
* to complete this operation. * to complete this operation.
*/ */
EXPORT_SPEC int ixmlDocument_createCDATASectionEx( EXPORT_SPEC int ixmlDocument_createCDATASectionEx(
/*! The owner \b Document of the new node. */ /*! [in] The owner \b Document of the new node. */
IXML_Document *doc, IXML_Document *doc,
/*! The data to associate with the new \b CDATASection node. */ /*! [in] The data to associate with the new \b CDATASection node. */
const DOMString data, const DOMString data,
/*! A pointer to a \b Node where the new object will be stored. */ /*! [out] A pointer to a \b Node where the new object will be stored. */
IXML_CDATASection** cdNode); IXML_CDATASection** cdNode);
@@ -841,21 +846,25 @@ EXPORT_SPEC int ixmlDocument_createCDATASectionEx(
* \return A pointer to the new \b CDATASection or \c NULL on failure. * \return A pointer to the new \b CDATASection or \c NULL on failure.
*/ */
EXPORT_SPEC IXML_CDATASection *ixmlDocument_createCDATASection( EXPORT_SPEC IXML_CDATASection *ixmlDocument_createCDATASection(
/*! The owner \b Document of the new node. */ /*! [in] The owner \b Document of the new node. */
IXML_Document *doc, IXML_Document *doc,
/*! The data to associate with the new \b CDATASection node. */ /*! [in] The data to associate with the new \b CDATASection node. */
const DOMString data); const DOMString data);
/*! /*!
* \brief Creates a new \b Attr node with the given name. * \brief Creates a new \b Attr node with the given name.
* *
* \return A pointer to the new \b Attr or \c NULL on failure. * \return A pointer to the new \b Attr object with the nodeName attribute
* set to the given name, and the localName, prefix and namespaceURI set
* to NULL or \c NULL on failure.
*
* The value of the attribute is the empty string.
*/ */
EXPORT_SPEC IXML_Attr *ixmlDocument_createAttribute( EXPORT_SPEC IXML_Attr *ixmlDocument_createAttribute(
/*! The owner \b Document of the new node. */ /*! [in] The owner \b Document of the new node. */
IXML_Document *doc, IXML_Document *doc,
/*! The name of the new attribute. */ /*! [in] The name of the new attribute. */
const char *name); const char *name);
@@ -874,11 +883,11 @@ EXPORT_SPEC IXML_Attr *ixmlDocument_createAttribute(
* to complete this operation. * to complete this operation.
*/ */
EXPORT_SPEC int ixmlDocument_createAttributeEx( EXPORT_SPEC int ixmlDocument_createAttributeEx(
/*! The owner \b Document of the new node. */ /*! [in] The owner \b Document of the new node. */
IXML_Document *doc, IXML_Document *doc,
/*! The name of the new attribute. */ /*! [in] The name of the new attribute. */
const char *name, const char *name,
/*! A pointer to a \b Attr where the new object will be stored. */ /*! [out] A pointer to a \b Attr where the new object will be stored. */
IXML_Attr **attrNode); IXML_Attr **attrNode);
@@ -891,9 +900,9 @@ EXPORT_SPEC int ixmlDocument_createAttributeEx(
* on an error. * on an error.
*/ */
EXPORT_SPEC IXML_NodeList *ixmlDocument_getElementsByTagName( EXPORT_SPEC IXML_NodeList *ixmlDocument_getElementsByTagName(
/*! The \b Document to search. */ /*! [in] The \b Document to search. */
IXML_Document *doc, IXML_Document *doc,
/*! The tag name to find. */ /*! [in] The tag name to find. The special value "*" matches all tags.*/
const DOMString tagName); const DOMString tagName);
@@ -918,13 +927,13 @@ EXPORT_SPEC IXML_NodeList *ixmlDocument_getElementsByTagName(
* to complete this operation. * to complete this operation.
*/ */
EXPORT_SPEC int ixmlDocument_createElementNSEx( EXPORT_SPEC int ixmlDocument_createElementNSEx(
/*! The owner \b Document of the new node. */ /*! [in] The owner \b Document of the new node. */
IXML_Document *doc, IXML_Document *doc,
/*! The namespace URI for the new \b Element. */ /*! [in] The namespace URI for the new \b Element. */
const DOMString namespaceURI, const DOMString namespaceURI,
/*! The qualified name of the new \b Element. */ /*! [in] The qualified name of the new \b Element. */
const DOMString qualifiedName, const DOMString qualifiedName,
/*! A pointer to an \b Element where the new object will be stored. */ /*! [out] A pointer to an \b Element where the new object will be stored. */
IXML_Element **rtElement); IXML_Element **rtElement);
@@ -932,14 +941,16 @@ EXPORT_SPEC int ixmlDocument_createElementNSEx(
* \brief Creates a new \b Element node in the given qualified name and * \brief Creates a new \b Element node in the given qualified name and
* namespace URI. * namespace URI.
* *
* \return A pointer to the new \b Element or \c NULL on failure. * \return A pointer to the new \b Element object with tagName qualifiedName,
* prefix and localName extraced from qualfiedName, nodeName of qualfiedName,
* namespaceURI of namespaceURI or \c NULL on failure.
*/ */
EXPORT_SPEC IXML_Element *ixmlDocument_createElementNS( EXPORT_SPEC IXML_Element *ixmlDocument_createElementNS(
/*! The owner \b Document of the new node. */ /*! [in] The owner \b Document of the new node. */
IXML_Document *doc, IXML_Document *doc,
/*! The namespace URI for the new \b Element. */ /*! [in] The namespace URI for the new \b Element. */
const DOMString namespaceURI, const DOMString namespaceURI,
/*! The qualified name of the new \b Element. */ /*! [in] The qualified name of the new \b Element. */
const DOMString qualifiedName); const DOMString qualifiedName);
@@ -959,28 +970,30 @@ EXPORT_SPEC IXML_Element *ixmlDocument_createElementNS(
* to complete this operation. * to complete this operation.
*/ */
EXPORT_SPEC int ixmlDocument_createAttributeNSEx( EXPORT_SPEC int ixmlDocument_createAttributeNSEx(
/*! The owner \b Document of the new \b Attr. */ /*! [in] The owner \b Document of the new \b Attr. */
IXML_Document *doc, IXML_Document *doc,
/*! The namespace URI for the attribute. */ /*! [in] The namespace URI for the attribute. */
const DOMString namespaceURI, const DOMString namespaceURI,
/*! The qualified name of the attribute. */ /*! [in] The qualified name of the attribute. */
const DOMString qualifiedName, const DOMString qualifiedName,
/*! A pointer to an \b Attr where the new object will be stored. */ /*! [out] A pointer to an \b Attr where the new object will be stored. */
IXML_Attr **attrNode); IXML_Attr **attrNode);
/*! /*!
* \brief Creates a new \b Attr node with the given qualified name and * \brief Creates a new \b Attribute node with the given qualified name and
* namespace URI. * namespace URI.
* *
* \return A pointer to the new \b Attr or \c NULL on failure. * \return A pointer to the new \b Attr node with the given namespaceURI and
* qualifiedName. The prefix and localname are extracted from
* the qualifiedName. The node value is empty. Or \c NULL on failure.
*/ */
EXPORT_SPEC IXML_Attr *ixmlDocument_createAttributeNS( EXPORT_SPEC IXML_Attr *ixmlDocument_createAttributeNS(
/*! The owner \b Document of the new \b Attr. */ /*! [in] The owner \b Document of the new \b Attribute. */
IXML_Document *doc, IXML_Document *doc,
/*! The namespace URI for the attribute. */ /*! [in] The namespace URI for the attribute. */
const DOMString namespaceURI, const DOMString namespaceURI,
/*! The qualified name of the attribute. */ /*! [in] The qualified name of the attribute. */
const DOMString qualifiedName); const DOMString qualifiedName);
@@ -996,12 +1009,12 @@ EXPORT_SPEC IXML_Attr *ixmlDocument_createAttributeNS(
* on an error. * on an error.
*/ */
EXPORT_SPEC IXML_NodeList *ixmlDocument_getElementsByTagNameNS( EXPORT_SPEC IXML_NodeList *ixmlDocument_getElementsByTagNameNS(
/*! The \b Document to search. */ /*! [in] The \b Document to search. */
IXML_Document *doc, IXML_Document *doc,
/*! The namespace of the elements to find or <tt>"*"</tt> to match any /*! [in] The namespace of the elements to find or <tt>"*"</tt> to match any
* namespace. */ * namespace. */
const DOMString namespaceURI, const DOMString namespaceURI,
/*! The local name of the elements to find or <tt>"*"</tt> to match any /*! [in] The local name of the elements to find or <tt>"*"</tt> to match any
* local name. */ * local name. */
const DOMString localName); const DOMString localName);
@@ -1012,9 +1025,9 @@ EXPORT_SPEC IXML_NodeList *ixmlDocument_getElementsByTagNameNS(
* \return A pointer to the matching \b Element or \c NULL on an error. * \return A pointer to the matching \b Element or \c NULL on an error.
*/ */
EXPORT_SPEC IXML_Element *ixmlDocument_getElementById( EXPORT_SPEC IXML_Element *ixmlDocument_getElementById(
/*! The owner \b Document of the \b Element. */ /*! [in] The owner \b Document of the \b Element. */
IXML_Document *doc, IXML_Document *doc,
/*! The name of the \b Element.*/ /*! [in] The name of the \b Element.*/
const DOMString tagName); const DOMString tagName);
@@ -1026,7 +1039,7 @@ EXPORT_SPEC IXML_Element *ixmlDocument_getElementById(
* explicitly cloned. * explicitly cloned.
*/ */
EXPORT_SPEC void ixmlDocument_free( EXPORT_SPEC void ixmlDocument_free(
/*! The \b Document to free. */ /*! [in] The \b Document to free. */
IXML_Document *doc); IXML_Document *doc);
@@ -1061,14 +1074,14 @@ EXPORT_SPEC void ixmlDocument_free(
* \b Node to be imported could not be cloned. * \b Node to be imported could not be cloned.
*/ */
EXPORT_SPEC int ixmlDocument_importNode( EXPORT_SPEC int ixmlDocument_importNode(
/*! The \b Document into which to import. */ /*! [in] The \b Document into which to import. */
IXML_Document *doc, IXML_Document *doc,
/*! The \b Node to import. */ /*! [in] The \b Node to import. */
IXML_Node * importNode, IXML_Node * importNode,
/*! \c TRUE to import all children of \b importNode or \c FALSE to /*! [in] \c TRUE to import all children of \b importNode or \c FALSE to
* import only the root node. */ * import only the root node. */
BOOL deep, BOOL deep,
/*! A pointer to a new \b Node owned by \b doc. */ /*! [out] A pointer to a new \b Node owned by \b doc. */
IXML_Node **rtNode); IXML_Node **rtNode);

View File

@@ -1,33 +1,33 @@
/////////////////////////////////////////////////////////////////////////// /*******************************************************************************
// *
// Copyright (c) 2000-2003 Intel Corporation * Copyright (c) 2000-2003 Intel Corporation
// All rights reserved. * All rights reserved.
// *
// Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
// *
// * Redistributions of source code must retain the above copyright notice, * - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer. * this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, * - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
// * Neither name of Intel Corporation nor the names of its contributors * - Neither name of Intel Corporation nor the names of its contributors
// may be used to endorse or promote products derived from this software * may be used to endorse or promote products derived from this software
// without specific prior written permission. * without specific prior written permission.
// *
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// *
/////////////////////////////////////////////////////////////////////////// ******************************************************************************/
#include <stdio.h> #include <stdio.h>
@@ -37,13 +37,13 @@
#include "ixmlparser.h" #include "ixmlparser.h"
void ixmlDocument_init(IN IXML_Document *doc) void ixmlDocument_init(IXML_Document *doc)
{ {
memset(doc, 0, sizeof(IXML_Document)); memset(doc, 0, sizeof(IXML_Document));
} }
void ixmlDocument_free(IN IXML_Document *doc) void ixmlDocument_free(IXML_Document *doc)
{ {
if (doc != NULL) { if (doc != NULL) {
ixmlNode_free((IXML_Node *)doc); ixmlNode_free((IXML_Node *)doc);
@@ -57,9 +57,11 @@ void ixmlDocument_free(IN IXML_Document *doc)
* *
* Internal function called by ixmlDocument_importNode * Internal function called by ixmlDocument_importNode
*/ */
void ixmlDocument_setOwnerDocument( static void ixmlDocument_setOwnerDocument(
IN IXML_Document *doc, /*! [in] The document node. */
IN IXML_Node *nodeptr) IXML_Document *doc,
/*! [in] \todo documentation. */
IXML_Node *nodeptr)
{ {
if (nodeptr != NULL) { if (nodeptr != NULL) {
nodeptr->ownerDocument = doc; nodeptr->ownerDocument = doc;
@@ -72,10 +74,10 @@ void ixmlDocument_setOwnerDocument(
int ixmlDocument_importNode( int ixmlDocument_importNode(
IN IXML_Document *doc, IXML_Document *doc,
IN IXML_Node *importNode, IXML_Node *importNode,
IN BOOL deep, BOOL deep,
OUT IXML_Node **rtNode) IXML_Node **rtNode)
{ {
unsigned short nodeType; unsigned short nodeType;
IXML_Node *newNode; IXML_Node *newNode;
@@ -104,9 +106,9 @@ int ixmlDocument_importNode(
int ixmlDocument_createElementEx( int ixmlDocument_createElementEx(
IN IXML_Document *doc, IXML_Document *doc,
IN const DOMString tagName, const DOMString tagName,
OUT IXML_Element **rtElement) IXML_Element **rtElement)
{ {
int errCode = IXML_SUCCESS; int errCode = IXML_SUCCESS;
IXML_Element *newElement = NULL; IXML_Element *newElement = NULL;
@@ -149,58 +151,34 @@ ErrorHandler:
} }
/*================================================================ IXML_Element *ixmlDocument_createElement(
* ixmlDocument_createElement IXML_Document *doc,
* Creates an element of the type specified. const DOMString tagName)
* External function.
* Parameters:
* doc: pointer to document
* tagName: The name of the element, it is case-sensitive.
* Return Value:
* A new element object with the nodeName set to tagName, and
* localName, prefix and namespaceURI set to null.
*
*=================================================================*/
IXML_Element *
ixmlDocument_createElement( IN IXML_Document * doc,
IN const DOMString tagName )
{ {
IXML_Element *newElement = NULL; IXML_Element *newElement = NULL;
ixmlDocument_createElementEx( doc, tagName, &newElement ); ixmlDocument_createElementEx(doc, tagName, &newElement);
return newElement; return newElement;
} }
/*================================================================
* ixmlDocument_createDocumentEx int ixmlDocument_createDocumentEx(IXML_Document **rtDoc)
* Creates an document object
* Internal function.
* Parameters:
* rtDoc: the document created or NULL on failure
* Return Value:
* IXML_SUCCESS
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
*
*=================================================================*/
int
ixmlDocument_createDocumentEx( OUT IXML_Document ** rtDoc )
{ {
IXML_Document *doc; IXML_Document *doc;
int errCode = IXML_SUCCESS; int errCode = IXML_SUCCESS;
doc = NULL; doc = NULL;
doc = ( IXML_Document * ) malloc( sizeof( IXML_Document ) ); doc = (IXML_Document *)malloc(sizeof (IXML_Document));
if( doc == NULL ) { if (doc == NULL) {
errCode = IXML_INSUFFICIENT_MEMORY; errCode = IXML_INSUFFICIENT_MEMORY;
goto ErrorHandler; goto ErrorHandler;
} }
ixmlDocument_init( doc ); ixmlDocument_init(doc);
doc->n.nodeName = strdup( DOCUMENTNODENAME ); doc->n.nodeName = strdup(DOCUMENTNODENAME);
if( doc->n.nodeName == NULL ) { if (doc->n.nodeName == NULL) {
ixmlDocument_free( doc ); ixmlDocument_free(doc);
doc = NULL; doc = NULL;
errCode = IXML_INSUFFICIENT_MEMORY; errCode = IXML_INSUFFICIENT_MEMORY;
goto ErrorHandler; goto ErrorHandler;
@@ -209,78 +187,56 @@ ixmlDocument_createDocumentEx( OUT IXML_Document ** rtDoc )
doc->n.nodeType = eDOCUMENT_NODE; doc->n.nodeType = eDOCUMENT_NODE;
doc->n.ownerDocument = doc; doc->n.ownerDocument = doc;
ErrorHandler: ErrorHandler:
*rtDoc = doc; *rtDoc = doc;
return errCode; return errCode;
} }
/*================================================================
* ixmlDocument_createDocument IXML_Document *ixmlDocument_createDocument()
* Creates an document object
* Internal function.
* Parameters:
* none
* Return Value:
* A new document object with the nodeName set to "#document".
*
*=================================================================*/
IXML_Document *
ixmlDocument_createDocument()
{ {
IXML_Document *doc = NULL; IXML_Document *doc = NULL;
ixmlDocument_createDocumentEx( &doc ); ixmlDocument_createDocumentEx(&doc);
return doc; return doc;
} }
/*================================================================
* ixmlDocument_createTextNodeEx int ixmlDocument_createTextNodeEx(
* Creates an text node. IXML_Document *doc,
* External function. const char *data,
* Parameters: IXML_Node **textNode)
* data: text data for the text node. It is stored in nodeValue field.
* Return Value:
* IXML_SUCCESS
* IXML_INVALID_PARAMETER: if either doc or data is NULL
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
*
*=================================================================*/
int
ixmlDocument_createTextNodeEx( IN IXML_Document * doc,
IN const char *data,
OUT IXML_Node ** textNode )
{ {
IXML_Node *returnNode; IXML_Node *returnNode;
int rc = IXML_SUCCESS; int rc = IXML_SUCCESS;
returnNode = NULL; returnNode = NULL;
if( ( doc == NULL ) || ( data == NULL ) ) { if (doc == NULL || data == NULL) {
rc = IXML_INVALID_PARAMETER; rc = IXML_INVALID_PARAMETER;
goto ErrorHandler; goto ErrorHandler;
} }
returnNode = ( IXML_Node * ) malloc( sizeof( IXML_Node ) ); returnNode = (IXML_Node *)malloc(sizeof (IXML_Node));
if( returnNode == NULL ) { if (returnNode == NULL) {
rc = IXML_INSUFFICIENT_MEMORY; rc = IXML_INSUFFICIENT_MEMORY;
goto ErrorHandler; goto ErrorHandler;
} }
// initialize the node // initialize the node
ixmlNode_init( returnNode ); ixmlNode_init(returnNode);
returnNode->nodeName = strdup( TEXTNODENAME ); returnNode->nodeName = strdup(TEXTNODENAME);
if( returnNode->nodeName == NULL ) { if (returnNode->nodeName == NULL) {
ixmlNode_free( returnNode ); ixmlNode_free(returnNode);
returnNode = NULL; returnNode = NULL;
rc = IXML_INSUFFICIENT_MEMORY; rc = IXML_INSUFFICIENT_MEMORY;
goto ErrorHandler; goto ErrorHandler;
} }
// add in node value // add in node value
if( data != NULL ) { if (data != NULL) {
returnNode->nodeValue = strdup( data ); returnNode->nodeValue = strdup(data);
if( returnNode->nodeValue == NULL ) { if (returnNode->nodeValue == NULL) {
ixmlNode_free( returnNode ); ixmlNode_free(returnNode);
returnNode = NULL; returnNode = NULL;
rc = IXML_INSUFFICIENT_MEMORY; rc = IXML_INSUFFICIENT_MEMORY;
goto ErrorHandler; goto ErrorHandler;
@@ -290,73 +246,52 @@ ixmlDocument_createTextNodeEx( IN IXML_Document * doc,
returnNode->nodeType = eTEXT_NODE; returnNode->nodeType = eTEXT_NODE;
returnNode->ownerDocument = doc; returnNode->ownerDocument = doc;
ErrorHandler: ErrorHandler:
*textNode = returnNode; *textNode = returnNode;
return rc; return rc;
} }
/*================================================================
* ixmlDocument_createTextNode IXML_Node *ixmlDocument_createTextNode(
* Creates an text node. IXML_Document *doc,
* External function. const char *data)
* Parameters:
* data: text data for the text node. It is stored in nodeValue field.
* Return Value:
* The new text node.
*
*=================================================================*/
IXML_Node *
ixmlDocument_createTextNode( IN IXML_Document * doc,
IN const char *data )
{ {
IXML_Node *returnNode = NULL; IXML_Node *returnNode = NULL;
ixmlDocument_createTextNodeEx( doc, data, &returnNode ); ixmlDocument_createTextNodeEx(doc, data, &returnNode);
return returnNode; return returnNode;
} }
/*================================================================
* ixmlDocument_createAttributeEx int ixmlDocument_createAttributeEx(
* Creates an attribute of the given name. IXML_Document *doc,
* External function. const char *name,
* Parameters: IXML_Attr **rtAttr)
* name: The name of the Attribute node.
* Return Value:
* IXML_SUCCESS
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
*
================================================================*/
int
ixmlDocument_createAttributeEx( IN IXML_Document * doc,
IN const char *name,
OUT IXML_Attr ** rtAttr )
{ {
IXML_Attr *attrNode = NULL; IXML_Attr *attrNode = NULL;
int errCode = IXML_SUCCESS; int errCode = IXML_SUCCESS;
attrNode = ( IXML_Attr * ) malloc( sizeof( IXML_Attr ) ); attrNode = (IXML_Attr *)malloc(sizeof (IXML_Attr));
if( attrNode == NULL ) { if (attrNode == NULL) {
errCode = IXML_INSUFFICIENT_MEMORY; errCode = IXML_INSUFFICIENT_MEMORY;
goto ErrorHandler; goto ErrorHandler;
} }
if( ( doc == NULL ) || ( name == NULL ) ) { if (doc == NULL || name == NULL) {
ixmlAttr_free( attrNode ); ixmlAttr_free(attrNode);
attrNode = NULL; attrNode = NULL;
errCode = IXML_INVALID_PARAMETER; errCode = IXML_INVALID_PARAMETER;
goto ErrorHandler; goto ErrorHandler;
} }
ixmlAttr_init( attrNode ); ixmlAttr_init(attrNode);
attrNode->n.nodeType = eATTRIBUTE_NODE; attrNode->n.nodeType = eATTRIBUTE_NODE;
// set the node fields // set the node fields
attrNode->n.nodeName = strdup( name ); attrNode->n.nodeName = strdup(name);
if( attrNode->n.nodeName == NULL ) { if (attrNode->n.nodeName == NULL) {
ixmlAttr_free( attrNode ); ixmlAttr_free(attrNode);
attrNode = NULL; attrNode = NULL;
errCode = IXML_INSUFFICIENT_MEMORY; errCode = IXML_INSUFFICIENT_MEMORY;
goto ErrorHandler; goto ErrorHandler;
@@ -364,161 +299,111 @@ ixmlDocument_createAttributeEx( IN IXML_Document * doc,
attrNode->n.ownerDocument = doc; attrNode->n.ownerDocument = doc;
ErrorHandler: ErrorHandler:
*rtAttr = attrNode; *rtAttr = attrNode;
return errCode; return errCode;
} }
/*================================================================
* ixmlDocument_createAttribute IXML_Attr *ixmlDocument_createAttribute(
* Creates an attribute of the given name. IXML_Document *doc,
* External function. const char *name)
* Parameters:
* name: The name of the Attribute node.
* Return Value:
* A new attr object with the nodeName attribute set to the
* given name, and the localName, prefix and namespaceURI set to NULL.
* The value of the attribute is the empty string.
*
================================================================*/
IXML_Attr *
ixmlDocument_createAttribute( IN IXML_Document * doc,
IN const char *name )
{ {
IXML_Attr *attrNode = NULL; IXML_Attr *attrNode = NULL;
ixmlDocument_createAttributeEx( doc, name, &attrNode ); ixmlDocument_createAttributeEx(doc, name, &attrNode);
return attrNode;
return attrNode;
} }
/*================================================================
* ixmlDocument_createAttributeNSEx int ixmlDocument_createAttributeNSEx(
* Creates an attrbute of the given name and namespace URI IXML_Document *doc,
* External function. const DOMString namespaceURI,
* Parameters: const DOMString qualifiedName,
* namespaceURI: the namespace fo the attribute to create IXML_Attr **rtAttr )
* qualifiedName: qualifiedName of the attribute to instantiate
* Return Value:
* IXML_SUCCESS
* IXML_INVALID_PARAMETER: if either doc,namespaceURI or qualifiedName is NULL
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
*
*=================================================================*/
int
ixmlDocument_createAttributeNSEx( IN IXML_Document * doc,
IN const DOMString namespaceURI,
IN const DOMString qualifiedName,
OUT IXML_Attr ** rtAttr )
{ {
IXML_Attr *attrNode = NULL; IXML_Attr *attrNode = NULL;
int errCode = IXML_SUCCESS; int errCode = IXML_SUCCESS;
if( ( doc == NULL ) || ( namespaceURI == NULL ) if (doc == NULL || namespaceURI == NULL || qualifiedName == NULL) {
|| ( qualifiedName == NULL ) ) {
errCode = IXML_INVALID_PARAMETER; errCode = IXML_INVALID_PARAMETER;
goto ErrorHandler; goto ErrorHandler;
} }
errCode = errCode =
ixmlDocument_createAttributeEx( doc, qualifiedName, &attrNode ); ixmlDocument_createAttributeEx(doc, qualifiedName, &attrNode);
if( errCode != IXML_SUCCESS ) { if (errCode != IXML_SUCCESS) {
goto ErrorHandler; goto ErrorHandler;
} }
// set the namespaceURI field // set the namespaceURI field
attrNode->n.namespaceURI = strdup( namespaceURI ); attrNode->n.namespaceURI = strdup(namespaceURI);
if( attrNode->n.namespaceURI == NULL ) { if (attrNode->n.namespaceURI == NULL) {
ixmlAttr_free( attrNode ); ixmlAttr_free(attrNode);
attrNode = NULL; attrNode = NULL;
errCode = IXML_INSUFFICIENT_MEMORY; errCode = IXML_INSUFFICIENT_MEMORY;
goto ErrorHandler; goto ErrorHandler;
} }
// set the localName and prefix // set the localName and prefix
errCode = errCode =
ixmlNode_setNodeName( ( IXML_Node * ) attrNode, qualifiedName ); ixmlNode_setNodeName((IXML_Node *)attrNode, qualifiedName);
if( errCode != IXML_SUCCESS ) { if (errCode != IXML_SUCCESS) {
ixmlAttr_free( attrNode ); ixmlAttr_free(attrNode);
attrNode = NULL; attrNode = NULL;
goto ErrorHandler; goto ErrorHandler;
} }
ErrorHandler: ErrorHandler:
*rtAttr = attrNode; *rtAttr = attrNode;
return errCode; return errCode;
} }
/*================================================================
* ixmlDocument_createAttributeNS IXML_Attr *ixmlDocument_createAttributeNS(
* Creates an attrbute of the given name and namespace URI IXML_Document *doc,
* External function. const DOMString namespaceURI,
* Parameters: const DOMString qualifiedName)
* namespaceURI: the namespace fo the attribute to create
* qualifiedName: qualifiedName of the attribute to instantiate
* Return Value:
* Creates an attribute node with the given namespaceURI and
* qualifiedName. The prefix and localname are extracted from
* the qualifiedName. The node value is empty.
*
*=================================================================*/
IXML_Attr *
ixmlDocument_createAttributeNS( IN IXML_Document * doc,
IN const DOMString namespaceURI,
IN const DOMString qualifiedName )
{ {
IXML_Attr *attrNode = NULL; IXML_Attr *attrNode = NULL;
ixmlDocument_createAttributeNSEx( doc, namespaceURI, qualifiedName, ixmlDocument_createAttributeNSEx(
&attrNode ); doc, namespaceURI, qualifiedName, &attrNode);
return attrNode; return attrNode;
} }
/*================================================================
* ixmlDocument_createCDATASectionEx int ixmlDocument_createCDATASectionEx(
* Creates an CDATASection node whose value is the specified string IXML_Document *doc,
* External function. const DOMString data,
* Parameters: IXML_CDATASection **rtCD)
* data: the data for the CDATASection contents.
* Return Value:
* IXML_SUCCESS
* IXML_INVALID_PARAMETER: if either doc or data is NULL
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
*
*=================================================================*/
int
ixmlDocument_createCDATASectionEx( IN IXML_Document * doc,
IN const DOMString data,
OUT IXML_CDATASection ** rtCD )
{ {
int errCode = IXML_SUCCESS; int errCode = IXML_SUCCESS;
IXML_CDATASection *cDSectionNode = NULL; IXML_CDATASection *cDSectionNode = NULL;
if( ( doc == NULL ) || ( data == NULL ) ) { if(doc == NULL || data == NULL) {
errCode = IXML_INVALID_PARAMETER; errCode = IXML_INVALID_PARAMETER;
goto ErrorHandler; goto ErrorHandler;
} }
cDSectionNode = cDSectionNode = (IXML_CDATASection *)malloc(sizeof (IXML_CDATASection));
( IXML_CDATASection * ) malloc( sizeof( IXML_CDATASection ) ); if (cDSectionNode == NULL) {
if( cDSectionNode == NULL ) {
errCode = IXML_INSUFFICIENT_MEMORY; errCode = IXML_INSUFFICIENT_MEMORY;
goto ErrorHandler; goto ErrorHandler;
} }
ixmlCDATASection_init( cDSectionNode ); ixmlCDATASection_init(cDSectionNode);
cDSectionNode->n.nodeType = eCDATA_SECTION_NODE; cDSectionNode->n.nodeType = eCDATA_SECTION_NODE;
cDSectionNode->n.nodeName = strdup( CDATANODENAME ); cDSectionNode->n.nodeName = strdup(CDATANODENAME);
if( cDSectionNode->n.nodeName == NULL ) { if (cDSectionNode->n.nodeName == NULL) {
ixmlCDATASection_free( cDSectionNode ); ixmlCDATASection_free(cDSectionNode);
cDSectionNode = NULL; cDSectionNode = NULL;
errCode = IXML_INSUFFICIENT_MEMORY; errCode = IXML_INSUFFICIENT_MEMORY;
goto ErrorHandler; goto ErrorHandler;
} }
cDSectionNode->n.nodeValue = strdup( data ); cDSectionNode->n.nodeValue = strdup(data);
if( cDSectionNode->n.nodeValue == NULL ) { if (cDSectionNode->n.nodeValue == NULL) {
ixmlCDATASection_free( cDSectionNode ); ixmlCDATASection_free( cDSectionNode );
cDSectionNode = NULL; cDSectionNode = NULL;
errCode = IXML_INSUFFICIENT_MEMORY; errCode = IXML_INSUFFICIENT_MEMORY;
@@ -527,81 +412,54 @@ ixmlDocument_createCDATASectionEx( IN IXML_Document * doc,
cDSectionNode->n.ownerDocument = doc; cDSectionNode->n.ownerDocument = doc;
ErrorHandler: ErrorHandler:
*rtCD = cDSectionNode; *rtCD = cDSectionNode;
return errCode; return errCode;
} }
/*================================================================
* ixmlDocument_createCDATASection
* Creates an CDATASection node whose value is the specified string
* External function.
* Parameters:
* data: the data for the CDATASection contents.
* Return Value:
* The new CDATASection object.
*
*=================================================================*/
IXML_CDATASection *
ixmlDocument_createCDATASection( IN IXML_Document * doc,
IN const DOMString data )
{
IXML_CDATASection *ixmlDocument_createCDATASection(
IXML_Document *doc,
const DOMString data)
{
IXML_CDATASection *cDSectionNode = NULL; IXML_CDATASection *cDSectionNode = NULL;
ixmlDocument_createCDATASectionEx( doc, data, &cDSectionNode ); ixmlDocument_createCDATASectionEx(doc, data, &cDSectionNode);
return cDSectionNode; return cDSectionNode;
} }
/*================================================================
* ixmlDocument_createElementNSEx
* Creates an element of the given qualified name and namespace URI.
* External function.
* Parameters:
* namespaceURI: the namespace URI of the element to create.
* qualifiedName: the qualified name of the element to instantiate.
* Return Value:
* Return Value:
* IXML_SUCCESS
* IXML_INVALID_PARAMETER: if either doc,namespaceURI or qualifiedName is NULL
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
*
*=================================================================*/
int
ixmlDocument_createElementNSEx( IN IXML_Document * doc,
IN const DOMString namespaceURI,
IN const DOMString qualifiedName,
OUT IXML_Element ** rtElement )
{
int ixmlDocument_createElementNSEx(
IXML_Document *doc,
const DOMString namespaceURI,
const DOMString qualifiedName,
IXML_Element **rtElement)
{
IXML_Element *newElement = NULL; IXML_Element *newElement = NULL;
int errCode = IXML_SUCCESS; int errCode = IXML_SUCCESS;
if( ( doc == NULL ) || ( namespaceURI == NULL ) if (doc == NULL || namespaceURI == NULL || qualifiedName == NULL) {
|| ( qualifiedName == NULL ) ) {
errCode = IXML_INVALID_PARAMETER; errCode = IXML_INVALID_PARAMETER;
goto ErrorHandler; goto ErrorHandler;
} }
errCode = errCode = ixmlDocument_createElementEx(doc, qualifiedName, &newElement);
ixmlDocument_createElementEx( doc, qualifiedName, &newElement ); if (errCode != IXML_SUCCESS) {
if( errCode != IXML_SUCCESS ) {
goto ErrorHandler; goto ErrorHandler;
} }
// set the namespaceURI field // set the namespaceURI field
newElement->n.namespaceURI = strdup( namespaceURI ); newElement->n.namespaceURI = strdup(namespaceURI);
if( newElement->n.namespaceURI == NULL ) { if (newElement->n.namespaceURI == NULL) {
ixmlElement_free( newElement ); ixmlElement_free(newElement);
newElement = NULL; newElement = NULL;
errCode = IXML_INSUFFICIENT_MEMORY; errCode = IXML_INSUFFICIENT_MEMORY;
goto ErrorHandler; goto ErrorHandler;
} }
// set the localName and prefix // set the localName and prefix
errCode = errCode = ixmlNode_setNodeName((IXML_Node *)newElement, qualifiedName);
ixmlNode_setNodeName( ( IXML_Node * ) newElement, qualifiedName ); if (errCode != IXML_SUCCESS) {
if( errCode != IXML_SUCCESS ) { ixmlElement_free(newElement);
ixmlElement_free( newElement );
newElement = NULL; newElement = NULL;
errCode = IXML_INSUFFICIENT_MEMORY; errCode = IXML_INSUFFICIENT_MEMORY;
goto ErrorHandler; goto ErrorHandler;
@@ -609,151 +467,98 @@ ixmlDocument_createElementNSEx( IN IXML_Document * doc,
newElement->n.nodeValue = NULL; newElement->n.nodeValue = NULL;
ErrorHandler: ErrorHandler:
*rtElement = newElement; *rtElement = newElement;
return errCode; return errCode;
} }
/*================================================================
* ixmlDocument_createElementNS IXML_Element *ixmlDocument_createElementNS(
* Creates an element of the given qualified name and namespace URI. IXML_Document *doc,
* External function. const DOMString namespaceURI,
* Parameters: const DOMString qualifiedName)
* namespaceURI: the namespace URI of the element to create.
* qualifiedName: the qualified name of the element to instantiate.
* Return Value:
* The new element object with tagName qualifiedName, prefix and
* localName extraced from qualfiedName, nodeName of qualfiedName,
* namespaceURI of namespaceURI.
*
*=================================================================*/
IXML_Element *
ixmlDocument_createElementNS( IN IXML_Document * doc,
IN const DOMString namespaceURI,
IN const DOMString qualifiedName )
{ {
IXML_Element *newElement = NULL; IXML_Element *newElement = NULL;
ixmlDocument_createElementNSEx( doc, namespaceURI, qualifiedName, ixmlDocument_createElementNSEx(doc, namespaceURI, qualifiedName, &newElement);
&newElement );
return newElement; return newElement;
} }
/*================================================================
* ixmlDocument_getElementsByTagName IXML_NodeList *ixmlDocument_getElementsByTagName(
* Returns a nodeList of all the Elements with a given tag name IXML_Document *doc,
* in the order in which they are encountered in a preorder traversal const char *tagName)
* of the document tree.
* External function.
* Parameters:
* tagName: the name of the tag to match on. The special value "*"
* matches all tags.
* Return Value:
* A new nodeList object containing all the matched Elements.
*
*=================================================================*/
IXML_NodeList *
ixmlDocument_getElementsByTagName( IN IXML_Document * doc,
IN const char *tagName )
{ {
IXML_NodeList *returnNodeList = NULL; IXML_NodeList *returnNodeList = NULL;
if( ( doc == NULL ) || ( tagName == NULL ) ) { if (doc == NULL || tagName == NULL) {
return NULL; return NULL;
} }
ixmlNode_getElementsByTagName( ( IXML_Node * ) doc, tagName, ixmlNode_getElementsByTagName((IXML_Node *)doc, tagName, &returnNodeList);
&returnNodeList );
return returnNodeList; return returnNodeList;
} }
/*================================================================
* ixmlDocument_getElementsByTagNameNS IXML_NodeList *ixmlDocument_getElementsByTagNameNS(
* Returns a nodeList of all the Elements with a given local name and IXML_Document *doc,
* namespace URI in the order in which they are encountered in a const DOMString namespaceURI,
* preorder traversal of the document tree. const DOMString localName)
* External function.
* Parameters:
* namespaceURI: the namespace of the elements to match on. The special
* value "*" matches all namespaces.
* localName: the local name of the elements to match on. The special
* value "*" matches all local names.
* Return Value:
* A new nodeList object containing all the matched Elements.
*
*=================================================================*/
IXML_NodeList *
ixmlDocument_getElementsByTagNameNS( IN IXML_Document * doc,
IN const DOMString namespaceURI,
IN const DOMString localName )
{ {
IXML_NodeList *returnNodeList = NULL; IXML_NodeList *returnNodeList = NULL;
if( ( doc == NULL ) || ( namespaceURI == NULL ) if (doc == NULL || namespaceURI == NULL || localName == NULL) {
|| ( localName == NULL ) ) {
return NULL; return NULL;
} }
ixmlNode_getElementsByTagNameNS( ( IXML_Node * ) doc, namespaceURI, ixmlNode_getElementsByTagNameNS(
localName, &returnNodeList ); (IXML_Node *)doc, namespaceURI, localName, &returnNodeList);
return returnNodeList; return returnNodeList;
} }
/*================================================================
* ixmlDocument_getElementById IXML_Element *ixmlDocument_getElementById(
* Returns the element whose ID is given by tagName. If no such IXML_Document *doc,
* element exists, returns null. const DOMString tagName)
* External function.
* Parameter:
* tagName: the tag name for an element.
* Return Values:
* The matching element.
*
*=================================================================*/
IXML_Element *
ixmlDocument_getElementById( IN IXML_Document * doc,
IN const DOMString tagName )
{ {
IXML_Element *rtElement = NULL; IXML_Element *rtElement = NULL;
IXML_Node *nodeptr = ( IXML_Node * ) doc; IXML_Node *nodeptr = (IXML_Node *)doc;
const char *name; const char *name;
if( ( nodeptr == NULL ) || ( tagName == NULL ) ) { if (nodeptr == NULL || tagName == NULL) {
return rtElement; return rtElement;
} }
if( ixmlNode_getNodeType( nodeptr ) == eELEMENT_NODE ) { if (ixmlNode_getNodeType(nodeptr) == eELEMENT_NODE) {
name = ixmlNode_getNodeName( nodeptr ); name = ixmlNode_getNodeName(nodeptr);
if( name == NULL ) { if (name == NULL) {
return rtElement; return rtElement;
} }
if( strcmp( tagName, name ) == 0 ) { if (strcmp(tagName, name) == 0) {
rtElement = ( IXML_Element * ) nodeptr; rtElement = (IXML_Element *)nodeptr;
return rtElement; return rtElement;
} else { } else {
rtElement = ixmlDocument_getElementById( ( IXML_Document * ) rtElement = ixmlDocument_getElementById(
ixmlNode_getFirstChild (IXML_Document *)ixmlNode_getFirstChild(nodeptr),
( nodeptr ),
tagName );
if( rtElement == NULL ) {
rtElement = ixmlDocument_getElementById( ( IXML_Document
* )
ixmlNode_getNextSibling
( nodeptr ),
tagName ); tagName );
if (rtElement == NULL) {
rtElement = ixmlDocument_getElementById(
(IXML_Document *)ixmlNode_getNextSibling(nodeptr),
tagName);
} }
} }
} else { } else {
rtElement = ixmlDocument_getElementById( ( IXML_Document * ) rtElement = ixmlDocument_getElementById(
ixmlNode_getFirstChild (IXML_Document *)ixmlNode_getFirstChild(nodeptr),
( nodeptr ), tagName ); tagName);
if( rtElement == NULL ) { if (rtElement == NULL) {
rtElement = ixmlDocument_getElementById( ( IXML_Document * ) rtElement = ixmlDocument_getElementById(
ixmlNode_getNextSibling (IXML_Document *)ixmlNode_getNextSibling(nodeptr),
( nodeptr ), tagName);
tagName );
} }
} }