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.
*/
EXPORT_SPEC void ixmlDocument_init(
/*! The \b Document node to initialize. */
/*! [in] The \b Document node to initialize. */
IXML_Document *nodeptr);
@@ -722,14 +722,15 @@ EXPORT_SPEC void ixmlDocument_init(
* to complete this operation.
*/
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);
/*!
* \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();
@@ -753,11 +754,11 @@ EXPORT_SPEC IXML_Document *ixmlDocument_createDocument();
* to complete this operation.
*/
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,
/*! The tag name of the new \b Element node. */
/*! [in] The tag name of the new \b Element node. */
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);
@@ -768,19 +769,21 @@ EXPORT_SPEC int ixmlDocument_createElementEx(
* \c localName, \c prefix, and \c namespaceURI set to \c NULL. To create an
* \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(
/*! The owner \b Document of the new node. */
/*! [in] The owner \b Document of the new node. */
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);
/*!
* \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
* describing the reason for failure rather than just \c NULL.
*
@@ -792,11 +795,12 @@ EXPORT_SPEC IXML_Element *ixmlDocument_createElement(
* to complete this operation.
*/
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,
/*! 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,
/*! 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);
@@ -806,9 +810,10 @@ EXPORT_SPEC int ixmlDocument_createTextNodeEx(
* \return A pointer to the new \b Node or \c NULL on failure.
*/
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,
/*! 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);
@@ -827,11 +832,11 @@ EXPORT_SPEC IXML_Node *ixmlDocument_createTextNode(
* to complete this operation.
*/
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,
/*! The data to associate with the new \b CDATASection node. */
/*! [in] The data to associate with the new \b CDATASection node. */
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);
@@ -841,21 +846,25 @@ EXPORT_SPEC int ixmlDocument_createCDATASectionEx(
* \return A pointer to the new \b CDATASection or \c NULL on failure.
*/
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,
/*! The data to associate with the new \b CDATASection node. */
/*! [in] The data to associate with the new \b CDATASection node. */
const DOMString data);
/*!
* \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(
/*! The owner \b Document of the new node. */
/*! [in] The owner \b Document of the new node. */
IXML_Document *doc,
/*! The name of the new attribute. */
/*! [in] The name of the new attribute. */
const char *name);
@@ -874,11 +883,11 @@ EXPORT_SPEC IXML_Attr *ixmlDocument_createAttribute(
* to complete this operation.
*/
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,
/*! The name of the new attribute. */
/*! [in] The name of the new attribute. */
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);
@@ -891,9 +900,9 @@ EXPORT_SPEC int ixmlDocument_createAttributeEx(
* on an error.
*/
EXPORT_SPEC IXML_NodeList *ixmlDocument_getElementsByTagName(
/*! The \b Document to search. */
/*! [in] The \b Document to search. */
IXML_Document *doc,
/*! The tag name to find. */
/*! [in] The tag name to find. The special value "*" matches all tags.*/
const DOMString tagName);
@@ -918,13 +927,13 @@ EXPORT_SPEC IXML_NodeList *ixmlDocument_getElementsByTagName(
* to complete this operation.
*/
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,
/*! The namespace URI for the new \b Element. */
/*! [in] The namespace URI for the new \b Element. */
const DOMString namespaceURI,
/*! The qualified name of the new \b Element. */
/*! [in] The qualified name of the new \b Element. */
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);
@@ -932,14 +941,16 @@ EXPORT_SPEC int ixmlDocument_createElementNSEx(
* \brief Creates a new \b Element node in the given qualified name and
* 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(
/*! The owner \b Document of the new node. */
/*! [in] The owner \b Document of the new node. */
IXML_Document *doc,
/*! The namespace URI for the new \b Element. */
/*! [in] The namespace URI for the new \b Element. */
const DOMString namespaceURI,
/*! The qualified name of the new \b Element. */
/*! [in] The qualified name of the new \b Element. */
const DOMString qualifiedName);
@@ -959,28 +970,30 @@ EXPORT_SPEC IXML_Element *ixmlDocument_createElementNS(
* to complete this operation.
*/
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,
/*! The namespace URI for the attribute. */
/*! [in] The namespace URI for the attribute. */
const DOMString namespaceURI,
/*! The qualified name of the attribute. */
/*! [in] The qualified name of the attribute. */
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);
/*!
* \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.
*
* \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(
/*! The owner \b Document of the new \b Attr. */
/*! [in] The owner \b Document of the new \b Attribute. */
IXML_Document *doc,
/*! The namespace URI for the attribute. */
/*! [in] The namespace URI for the attribute. */
const DOMString namespaceURI,
/*! The qualified name of the attribute. */
/*! [in] The qualified name of the attribute. */
const DOMString qualifiedName);
@@ -996,12 +1009,12 @@ EXPORT_SPEC IXML_Attr *ixmlDocument_createAttributeNS(
* on an error.
*/
EXPORT_SPEC IXML_NodeList *ixmlDocument_getElementsByTagNameNS(
/*! The \b Document to search. */
/*! [in] The \b Document to search. */
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. */
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. */
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.
*/
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,
/*! The name of the \b Element.*/
/*! [in] The name of the \b Element.*/
const DOMString tagName);
@@ -1026,7 +1039,7 @@ EXPORT_SPEC IXML_Element *ixmlDocument_getElementById(
* explicitly cloned.
*/
EXPORT_SPEC void ixmlDocument_free(
/*! The \b Document to free. */
/*! [in] The \b Document to free. */
IXML_Document *doc);
@@ -1061,14 +1074,14 @@ EXPORT_SPEC void ixmlDocument_free(
* \b Node to be imported could not be cloned.
*/
EXPORT_SPEC int ixmlDocument_importNode(
/*! The \b Document into which to import. */
/*! [in] The \b Document into which to import. */
IXML_Document *doc,
/*! The \b Node to import. */
/*! [in] The \b Node to import. */
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. */
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);

View File

@@ -1,33 +1,33 @@
///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000-2003 Intel Corporation
// All rights reserved.
//
// 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 conditions 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.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////
/*******************************************************************************
*
* Copyright (c) 2000-2003 Intel Corporation
* All rights reserved.
*
* 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 conditions 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.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
#include <stdio.h>
@@ -37,13 +37,13 @@
#include "ixmlparser.h"
void ixmlDocument_init(IN IXML_Document *doc)
void ixmlDocument_init(IXML_Document *doc)
{
memset(doc, 0, sizeof(IXML_Document));
}
void ixmlDocument_free(IN IXML_Document *doc)
void ixmlDocument_free(IXML_Document *doc)
{
if (doc != NULL) {
ixmlNode_free((IXML_Node *)doc);
@@ -57,9 +57,11 @@ void ixmlDocument_free(IN IXML_Document *doc)
*
* Internal function called by ixmlDocument_importNode
*/
void ixmlDocument_setOwnerDocument(
IN IXML_Document *doc,
IN IXML_Node *nodeptr)
static void ixmlDocument_setOwnerDocument(
/*! [in] The document node. */
IXML_Document *doc,
/*! [in] \todo documentation. */
IXML_Node *nodeptr)
{
if (nodeptr != NULL) {
nodeptr->ownerDocument = doc;
@@ -72,10 +74,10 @@ void ixmlDocument_setOwnerDocument(
int ixmlDocument_importNode(
IN IXML_Document *doc,
IN IXML_Node *importNode,
IN BOOL deep,
OUT IXML_Node **rtNode)
IXML_Document *doc,
IXML_Node *importNode,
BOOL deep,
IXML_Node **rtNode)
{
unsigned short nodeType;
IXML_Node *newNode;
@@ -104,9 +106,9 @@ int ixmlDocument_importNode(
int ixmlDocument_createElementEx(
IN IXML_Document *doc,
IN const DOMString tagName,
OUT IXML_Element **rtElement)
IXML_Document *doc,
const DOMString tagName,
IXML_Element **rtElement)
{
int errCode = IXML_SUCCESS;
IXML_Element *newElement = NULL;
@@ -149,42 +151,18 @@ ErrorHandler:
}
/*================================================================
* ixmlDocument_createElement
* Creates an element of the type specified.
* 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 *ixmlDocument_createElement(
IXML_Document *doc,
const DOMString tagName)
{
IXML_Element *newElement = NULL;
ixmlDocument_createElementEx(doc, tagName, &newElement);
return newElement;
}
/*================================================================
* ixmlDocument_createDocumentEx
* 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 )
int ixmlDocument_createDocumentEx(IXML_Document **rtDoc)
{
IXML_Document *doc;
int errCode = IXML_SUCCESS;
@@ -214,49 +192,27 @@ ixmlDocument_createDocumentEx( OUT IXML_Document ** rtDoc )
return errCode;
}
/*================================================================
* 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 *ixmlDocument_createDocument()
{
IXML_Document *doc = NULL;
ixmlDocument_createDocumentEx(&doc);
return doc;
}
/*================================================================
* ixmlDocument_createTextNodeEx
* Creates an text node.
* External function.
* Parameters:
* 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 )
int ixmlDocument_createTextNodeEx(
IXML_Document *doc,
const char *data,
IXML_Node **textNode)
{
IXML_Node *returnNode;
int rc = IXML_SUCCESS;
returnNode = NULL;
if( ( doc == NULL ) || ( data == NULL ) ) {
if (doc == NULL || data == NULL) {
rc = IXML_INVALID_PARAMETER;
goto ErrorHandler;
}
@@ -293,22 +249,12 @@ ixmlDocument_createTextNodeEx( IN IXML_Document * doc,
ErrorHandler:
*textNode = returnNode;
return rc;
}
/*================================================================
* ixmlDocument_createTextNode
* Creates an text node.
* External function.
* 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 *ixmlDocument_createTextNode(
IXML_Document *doc,
const char *data)
{
IXML_Node *returnNode = NULL;
@@ -317,21 +263,11 @@ ixmlDocument_createTextNode( IN IXML_Document * doc,
return returnNode;
}
/*================================================================
* ixmlDocument_createAttributeEx
* Creates an attribute of the given name.
* External function.
* Parameters:
* 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 )
int ixmlDocument_createAttributeEx(
IXML_Document *doc,
const char *name,
IXML_Attr **rtAttr)
{
IXML_Attr *attrNode = NULL;
int errCode = IXML_SUCCESS;
@@ -342,7 +278,7 @@ ixmlDocument_createAttributeEx( IN IXML_Document * doc,
goto ErrorHandler;
}
if( ( doc == NULL ) || ( name == NULL ) ) {
if (doc == NULL || name == NULL) {
ixmlAttr_free(attrNode);
attrNode = NULL;
errCode = IXML_INVALID_PARAMETER;
@@ -350,7 +286,6 @@ ixmlDocument_createAttributeEx( IN IXML_Document * doc,
}
ixmlAttr_init(attrNode);
attrNode->n.nodeType = eATTRIBUTE_NODE;
// set the node fields
@@ -367,56 +302,31 @@ ixmlDocument_createAttributeEx( IN IXML_Document * doc,
ErrorHandler:
*rtAttr = attrNode;
return errCode;
}
/*================================================================
* ixmlDocument_createAttribute
* Creates an attribute of the given name.
* External function.
* 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 *ixmlDocument_createAttribute(
IXML_Document *doc,
const char *name)
{
IXML_Attr *attrNode = NULL;
ixmlDocument_createAttributeEx(doc, name, &attrNode);
return attrNode;
return attrNode;
}
/*================================================================
* ixmlDocument_createAttributeNSEx
* Creates an attrbute of the given name and namespace URI
* External function.
* Parameters:
* namespaceURI: the namespace fo the attribute to create
* 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 )
int ixmlDocument_createAttributeNSEx(
IXML_Document *doc,
const DOMString namespaceURI,
const DOMString qualifiedName,
IXML_Attr **rtAttr )
{
IXML_Attr *attrNode = NULL;
int errCode = IXML_SUCCESS;
if( ( doc == NULL ) || ( namespaceURI == NULL )
|| ( qualifiedName == NULL ) ) {
if (doc == NULL || namespaceURI == NULL || qualifiedName == NULL) {
errCode = IXML_INVALID_PARAMETER;
goto ErrorHandler;
}
@@ -446,68 +356,43 @@ ixmlDocument_createAttributeNSEx( IN IXML_Document * doc,
ErrorHandler:
*rtAttr = attrNode;
return errCode;
}
/*================================================================
* ixmlDocument_createAttributeNS
* Creates an attrbute of the given name and namespace URI
* External function.
* Parameters:
* 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 *ixmlDocument_createAttributeNS(
IXML_Document *doc,
const DOMString namespaceURI,
const DOMString qualifiedName)
{
IXML_Attr *attrNode = NULL;
ixmlDocument_createAttributeNSEx( doc, namespaceURI, qualifiedName,
&attrNode );
ixmlDocument_createAttributeNSEx(
doc, namespaceURI, qualifiedName, &attrNode);
return attrNode;
}
/*================================================================
* ixmlDocument_createCDATASectionEx
* Creates an CDATASection node whose value is the specified string
* External function.
* Parameters:
* 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 ixmlDocument_createCDATASectionEx(
IXML_Document *doc,
const DOMString data,
IXML_CDATASection **rtCD)
{
int errCode = IXML_SUCCESS;
IXML_CDATASection *cDSectionNode = NULL;
if( ( doc == NULL ) || ( data == NULL ) ) {
if(doc == NULL || data == NULL) {
errCode = IXML_INVALID_PARAMETER;
goto ErrorHandler;
}
cDSectionNode =
( IXML_CDATASection * ) malloc( sizeof( IXML_CDATASection ) );
cDSectionNode = (IXML_CDATASection *)malloc(sizeof (IXML_CDATASection));
if (cDSectionNode == NULL) {
errCode = IXML_INSUFFICIENT_MEMORY;
goto ErrorHandler;
}
ixmlCDATASection_init(cDSectionNode);
cDSectionNode->n.nodeType = eCDATA_SECTION_NODE;
cDSectionNode->n.nodeName = strdup(CDATANODENAME);
if (cDSectionNode->n.nodeName == NULL) {
@@ -530,62 +415,36 @@ ixmlDocument_createCDATASectionEx( IN IXML_Document * doc,
ErrorHandler:
*rtCD = cDSectionNode;
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;
ixmlDocument_createCDATASectionEx(doc, data, &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;
int errCode = IXML_SUCCESS;
if( ( doc == NULL ) || ( namespaceURI == NULL )
|| ( qualifiedName == NULL ) ) {
if (doc == NULL || namespaceURI == NULL || qualifiedName == NULL) {
errCode = IXML_INVALID_PARAMETER;
goto ErrorHandler;
}
errCode =
ixmlDocument_createElementEx( doc, qualifiedName, &newElement );
errCode = ixmlDocument_createElementEx(doc, qualifiedName, &newElement);
if (errCode != IXML_SUCCESS) {
goto ErrorHandler;
}
@@ -598,8 +457,7 @@ ixmlDocument_createElementNSEx( IN IXML_Document * doc,
goto ErrorHandler;
}
// set the localName and prefix
errCode =
ixmlNode_setNodeName( ( IXML_Node * ) newElement, qualifiedName );
errCode = ixmlNode_setNodeName((IXML_Node *)newElement, qualifiedName);
if (errCode != IXML_SUCCESS) {
ixmlElement_free(newElement);
newElement = NULL;
@@ -612,114 +470,65 @@ ixmlDocument_createElementNSEx( IN IXML_Document * doc,
ErrorHandler:
*rtElement = newElement;
return errCode;
}
/*================================================================
* ixmlDocument_createElementNS
* 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:
* 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 *ixmlDocument_createElementNS(
IXML_Document *doc,
const DOMString namespaceURI,
const DOMString qualifiedName)
{
IXML_Element *newElement = NULL;
ixmlDocument_createElementNSEx( doc, namespaceURI, qualifiedName,
&newElement );
ixmlDocument_createElementNSEx(doc, namespaceURI, qualifiedName, &newElement);
return newElement;
}
/*================================================================
* ixmlDocument_getElementsByTagName
* Returns a nodeList of all the Elements with a given tag name
* in the order in which they are encountered in a preorder traversal
* 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 *ixmlDocument_getElementsByTagName(
IXML_Document *doc,
const char *tagName)
{
IXML_NodeList *returnNodeList = NULL;
if( ( doc == NULL ) || ( tagName == NULL ) ) {
if (doc == NULL || tagName == NULL) {
return NULL;
}
ixmlNode_getElementsByTagName( ( IXML_Node * ) doc, tagName,
&returnNodeList );
ixmlNode_getElementsByTagName((IXML_Node *)doc, tagName, &returnNodeList);
return returnNodeList;
}
/*================================================================
* ixmlDocument_getElementsByTagNameNS
* Returns a nodeList of all the Elements with a given local name and
* namespace URI in the order in which they are encountered in a
* preorder traversal of the document tree.
* 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 *ixmlDocument_getElementsByTagNameNS(
IXML_Document *doc,
const DOMString namespaceURI,
const DOMString localName)
{
IXML_NodeList *returnNodeList = NULL;
if( ( doc == NULL ) || ( namespaceURI == NULL )
|| ( localName == NULL ) ) {
if (doc == NULL || namespaceURI == NULL || localName == NULL) {
return NULL;
}
ixmlNode_getElementsByTagNameNS( ( IXML_Node * ) doc, namespaceURI,
localName, &returnNodeList );
ixmlNode_getElementsByTagNameNS(
(IXML_Node *)doc, namespaceURI, localName, &returnNodeList);
return returnNodeList;
}
/*================================================================
* ixmlDocument_getElementById
* Returns the element whose ID is given by tagName. If no such
* element exists, returns null.
* 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 *ixmlDocument_getElementById(
IXML_Document *doc,
const DOMString tagName)
{
IXML_Element *rtElement = NULL;
IXML_Node *nodeptr = (IXML_Node *)doc;
const char *name;
if( ( nodeptr == NULL ) || ( tagName == NULL ) ) {
if (nodeptr == NULL || tagName == NULL) {
return rtElement;
}
@@ -733,26 +542,22 @@ ixmlDocument_getElementById( IN IXML_Document * doc,
rtElement = (IXML_Element *)nodeptr;
return rtElement;
} else {
rtElement = ixmlDocument_getElementById( ( IXML_Document * )
ixmlNode_getFirstChild
( nodeptr ),
rtElement = ixmlDocument_getElementById(
(IXML_Document *)ixmlNode_getFirstChild(nodeptr),
tagName );
if (rtElement == NULL) {
rtElement = ixmlDocument_getElementById( ( IXML_Document
* )
ixmlNode_getNextSibling
( nodeptr ),
rtElement = ixmlDocument_getElementById(
(IXML_Document *)ixmlNode_getNextSibling(nodeptr),
tagName);
}
}
} else {
rtElement = ixmlDocument_getElementById( ( IXML_Document * )
ixmlNode_getFirstChild
( nodeptr ), tagName );
rtElement = ixmlDocument_getElementById(
(IXML_Document *)ixmlNode_getFirstChild(nodeptr),
tagName);
if (rtElement == NULL) {
rtElement = ixmlDocument_getElementById( ( IXML_Document * )
ixmlNode_getNextSibling
( nodeptr ),
rtElement = ixmlDocument_getElementById(
(IXML_Document *)ixmlNode_getNextSibling(nodeptr),
tagName);
}
}