More doxygen.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@370 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
9e54783740
commit
4e6102d1c2
@ -296,21 +296,7 @@ EXPORT_SPEC int ixmlNode_setNodeValue(
|
||||
/*!
|
||||
* \brief Retrieves the type of a \b Node.
|
||||
*
|
||||
* The defined \b Node constants are:
|
||||
* \li \c eATTRIBUTE_NODE
|
||||
* \li \c eCDATA_SECTION_NODE
|
||||
* \li \c eCOMMENT_NODE
|
||||
* \li \c eDOCUMENT_FRAGMENT_NODE
|
||||
* \li \c eDOCUMENT_NODE
|
||||
* \li \c eDOCUMENT_TYPE_NODE
|
||||
* \li \c eELEMENT_NODE
|
||||
* \li \c eENTITY_NODE
|
||||
* \li \c eENTITY_REFERENCE_NODE
|
||||
* \li \c eNOTATION_NODE
|
||||
* \li \c ePROCESSING_INSTRUCTION_NODE
|
||||
* \li \c eTEXT_NODE
|
||||
*
|
||||
* \return An integer representing the type of the \b Node.
|
||||
* \return An enum IXML_NODE_TYPE representing the type of the \b Node.
|
||||
*/
|
||||
EXPORT_SPEC unsigned short ixmlNode_getNodeType(
|
||||
/*! The \b Node from which to retrieve the type. */
|
||||
@ -1035,8 +1021,17 @@ EXPORT_SPEC void ixmlDocument_free(
|
||||
/*!
|
||||
* \brief Imports a \b Node from another \b Document into this \b Document.
|
||||
*
|
||||
* The new \b Node does not a have parent node: it is a clone of the original
|
||||
* \b Node with the \c ownerDocument set to \b doc.
|
||||
* The returned new \b Node does not a have parent node (parentNode is null):
|
||||
* it is a clone of the original \b Node with the \c ownerDocument set to
|
||||
* \b doc. The source node is not altered or removed from the original
|
||||
* document.
|
||||
*
|
||||
* For all nodes, importing a node creates a node object owned by the
|
||||
* importing document, with attribute values identical to the source
|
||||
* node's nodeName and nodeType, plus the attributes related to namespaces
|
||||
* (prefix, localName, and namespaceURI).
|
||||
*
|
||||
* As in the cloneNode operation on a node, the source node is not altered.
|
||||
*
|
||||
* The \b deep parameter controls whether all the children of the \b Node are
|
||||
* imported.
|
||||
|
@ -29,32 +29,22 @@
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "ixmlparser.h"
|
||||
|
||||
/*================================================================
|
||||
* Function: Attr_init
|
||||
* Initializes an attribute node
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixmlAttr_init( IN IXML_Attr * attr )
|
||||
|
||||
void ixmlAttr_init(IN IXML_Attr *attr)
|
||||
{
|
||||
if( attr != NULL ) {
|
||||
memset( attr, 0, sizeof( IXML_Attr ) );
|
||||
if (attr != NULL) {
|
||||
memset(attr, 0, sizeof (IXML_Attr));
|
||||
}
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* Function: Attr_free
|
||||
* Frees an attribute node.
|
||||
* external function.
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixmlAttr_free( IN IXML_Attr * attr )
|
||||
|
||||
void ixmlAttr_free(IN IXML_Attr *attr)
|
||||
{
|
||||
if( attr != NULL ) {
|
||||
ixmlNode_free( ( IXML_Node * ) attr );
|
||||
if (attr != NULL) {
|
||||
ixmlNode_free((IXML_Node *)attr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,156 +29,112 @@
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
#include "ixmlparser.h"
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_init
|
||||
* It initialize the document structure.
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixmlDocument_init( IN IXML_Document * doc )
|
||||
|
||||
void ixmlDocument_init(IN IXML_Document *doc)
|
||||
{
|
||||
memset( doc, 0, sizeof( IXML_Document ) );
|
||||
memset(doc, 0, sizeof(IXML_Document));
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_free
|
||||
* It frees the whole document tree.
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixmlDocument_free( IN IXML_Document * doc )
|
||||
|
||||
void ixmlDocument_free(IN IXML_Document *doc)
|
||||
{
|
||||
if( doc != NULL ) {
|
||||
ixmlNode_free( ( IXML_Node * ) doc );
|
||||
if (doc != NULL) {
|
||||
ixmlNode_free((IXML_Node *)doc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_setOwnerDocument
|
||||
*
|
||||
* When this function is called first time, nodeptr is the root
|
||||
* of the subtree, so it is not necessay to do two steps
|
||||
* recursion.
|
||||
*
|
||||
* Internal function called by ixmlDocument_importNode
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixmlDocument_setOwnerDocument( IN IXML_Document * doc,
|
||||
IN IXML_Node * nodeptr )
|
||||
|
||||
/*!
|
||||
* When this function is called first time, nodeptr is the root of the subtree,
|
||||
* so it is not necessay to do two steps recursion.
|
||||
*
|
||||
* Internal function called by ixmlDocument_importNode
|
||||
*/
|
||||
void ixmlDocument_setOwnerDocument(
|
||||
IN IXML_Document *doc,
|
||||
IN IXML_Node *nodeptr)
|
||||
{
|
||||
if( nodeptr != NULL ) {
|
||||
if (nodeptr != NULL) {
|
||||
nodeptr->ownerDocument = doc;
|
||||
ixmlDocument_setOwnerDocument( doc,
|
||||
ixmlNode_getFirstChild( nodeptr ) );
|
||||
ixmlDocument_setOwnerDocument( doc,
|
||||
ixmlNode_getNextSibling
|
||||
( nodeptr ) );
|
||||
ixmlDocument_setOwnerDocument(
|
||||
doc, ixmlNode_getFirstChild(nodeptr));
|
||||
ixmlDocument_setOwnerDocument(
|
||||
doc, ixmlNode_getNextSibling(nodeptr));
|
||||
}
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_importNode
|
||||
* Imports a node from another document to this document. The
|
||||
* returned node has no parent; (parentNode is null). The source
|
||||
* node is not altered or removed from the original document;
|
||||
* this method creates a new copy of the source node.
|
||||
|
||||
* For all nodes, importing a node creates a node object owned
|
||||
* by the importing document, with attribute values identical to
|
||||
* the source node's nodeName and nodeType, plus the attributes
|
||||
* related to namespaces (prefix, localName, and namespaceURI).
|
||||
* As in the cloneNode operation on a node, the source node is
|
||||
* not altered.
|
||||
*
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
int
|
||||
ixmlDocument_importNode( IN IXML_Document * doc,
|
||||
IN IXML_Node * importNode,
|
||||
int ixmlDocument_importNode(
|
||||
IN IXML_Document *doc,
|
||||
IN IXML_Node *importNode,
|
||||
IN BOOL deep,
|
||||
OUT IXML_Node ** rtNode )
|
||||
OUT IXML_Node **rtNode)
|
||||
{
|
||||
unsigned short nodeType;
|
||||
IXML_Node *newNode;
|
||||
|
||||
*rtNode = NULL;
|
||||
|
||||
if( ( doc == NULL ) || ( importNode == NULL ) ) {
|
||||
if (doc == NULL || importNode == NULL) {
|
||||
return IXML_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
nodeType = ixmlNode_getNodeType( importNode );
|
||||
if( nodeType == eDOCUMENT_NODE ) {
|
||||
nodeType = ixmlNode_getNodeType(importNode);
|
||||
if (nodeType == eDOCUMENT_NODE) {
|
||||
return IXML_NOT_SUPPORTED_ERR;
|
||||
}
|
||||
|
||||
newNode = ixmlNode_cloneNode( importNode, deep );
|
||||
if( newNode == NULL ) {
|
||||
newNode = ixmlNode_cloneNode(importNode, deep);
|
||||
if (newNode == NULL) {
|
||||
return IXML_FAILED;
|
||||
}
|
||||
|
||||
ixmlDocument_setOwnerDocument( doc, newNode );
|
||||
ixmlDocument_setOwnerDocument(doc, newNode);
|
||||
*rtNode = newNode;
|
||||
|
||||
return IXML_SUCCESS;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_createElementEx
|
||||
* 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:
|
||||
* IXML_SUCCESS
|
||||
* IXML_INVALID_PARAMETER: if either doc or tagName is NULL
|
||||
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
|
||||
*
|
||||
*=================================================================*/
|
||||
int
|
||||
ixmlDocument_createElementEx( IN IXML_Document * doc,
|
||||
IN const DOMString tagName,
|
||||
OUT IXML_Element ** rtElement )
|
||||
{
|
||||
|
||||
int ixmlDocument_createElementEx(
|
||||
IN IXML_Document *doc,
|
||||
IN const DOMString tagName,
|
||||
OUT IXML_Element **rtElement)
|
||||
{
|
||||
int errCode = IXML_SUCCESS;
|
||||
IXML_Element *newElement = NULL;
|
||||
|
||||
if( ( doc == NULL ) || ( tagName == NULL ) ) {
|
||||
if (doc == NULL || tagName == NULL) {
|
||||
errCode = IXML_INVALID_PARAMETER;
|
||||
goto ErrorHandler;
|
||||
}
|
||||
|
||||
newElement = ( IXML_Element * ) malloc( sizeof( IXML_Element ) );
|
||||
if( newElement == NULL ) {
|
||||
newElement = (IXML_Element *) malloc(sizeof(IXML_Element));
|
||||
if (newElement == NULL) {
|
||||
errCode = IXML_INSUFFICIENT_MEMORY;
|
||||
goto ErrorHandler;
|
||||
}
|
||||
|
||||
ixmlElement_init( newElement );
|
||||
newElement->tagName = strdup( tagName );
|
||||
if( newElement->tagName == NULL ) {
|
||||
ixmlElement_free( newElement );
|
||||
ixmlElement_init(newElement);
|
||||
newElement->tagName = strdup(tagName);
|
||||
if (newElement->tagName == NULL) {
|
||||
ixmlElement_free(newElement);
|
||||
newElement = NULL;
|
||||
errCode = IXML_INSUFFICIENT_MEMORY;
|
||||
goto ErrorHandler;
|
||||
}
|
||||
// set the node fields
|
||||
newElement->n.nodeType = eELEMENT_NODE;
|
||||
newElement->n.nodeName = strdup( tagName );
|
||||
if( newElement->n.nodeName == NULL ) {
|
||||
ixmlElement_free( newElement );
|
||||
newElement->n.nodeName = strdup(tagName);
|
||||
if (newElement->n.nodeName == NULL) {
|
||||
ixmlElement_free(newElement);
|
||||
newElement = NULL;
|
||||
errCode = IXML_INSUFFICIENT_MEMORY;
|
||||
goto ErrorHandler;
|
||||
@ -186,12 +142,13 @@ ixmlDocument_createElementEx( IN IXML_Document * doc,
|
||||
|
||||
newElement->n.ownerDocument = doc;
|
||||
|
||||
ErrorHandler:
|
||||
ErrorHandler:
|
||||
*rtElement = newElement;
|
||||
return errCode;
|
||||
|
||||
return errCode;
|
||||
}
|
||||
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_createElement
|
||||
* Creates an element of the type specified.
|
||||
@ -802,3 +759,4 @@ ixmlDocument_getElementById( IN IXML_Document * doc,
|
||||
|
||||
return rtElement;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user