ixml.h
Go to the documentation of this file.
/**************************************************************************
*
* 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.
*
**************************************************************************/
#ifndef IXML_H
#define IXML_H
#include "UpnpGlobal.h" /* For EXPORT_SPEC */
typedef int BOOL;
#define DOMString char *
/*typedef char *DOMString;*/
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef IN
#define IN
#endif
#ifndef OUT
#define OUT
#endif
#ifndef INOUT
#define INOUT
#endif
typedef enum {
eINVALID_NODE = 0,
eELEMENT_NODE = 1,
eATTRIBUTE_NODE = 2,
eTEXT_NODE = 3,
eCDATA_SECTION_NODE = 4,
eENTITY_REFERENCE_NODE = 5,
eENTITY_NODE = 6,
ePROCESSING_INSTRUCTION_NODE = 7,
eCOMMENT_NODE = 8,
eDOCUMENT_NODE = 9,
eDOCUMENT_TYPE_NODE = 10,
eDOCUMENT_FRAGMENT_NODE = 11,
eNOTATION_NODE = 12,
} IXML_NODE_TYPE;
typedef enum {
IXML_SUCCESS = 0,
IXML_INDEX_SIZE_ERR = 1,
IXML_DOMSTRING_SIZE_ERR = 2,
IXML_HIERARCHY_REQUEST_ERR = 3,
IXML_WRONG_DOCUMENT_ERR = 4,
IXML_INVALID_CHARACTER_ERR = 5,
IXML_NO_DATA_ALLOWED_ERR = 6,
IXML_NO_MODIFICATION_ALLOWED_ERR = 7,
IXML_NOT_FOUND_ERR = 8,
IXML_NOT_SUPPORTED_ERR = 9,
IXML_INUSE_ATTRIBUTE_ERR = 10,
IXML_INVALID_STATE_ERR = 11,
IXML_SYNTAX_ERR = 12,
IXML_INVALID_MODIFICATION_ERR = 13,
IXML_NAMESPACE_ERR = 14,
IXML_INVALID_ACCESS_ERR = 15,
IXML_NO_SUCH_FILE = 101,
IXML_INSUFFICIENT_MEMORY = 102,
IXML_FILE_DONE = 104,
IXML_INVALID_PARAMETER = 105,
IXML_FAILED = 106,
IXML_INVALID_ITEM_NUMBER = 107,
} IXML_ERRORCODE;
#define DOCUMENTNODENAME "#document"
#define TEXTNODENAME "#text"
#define CDATANODENAME "#cdata-section"
typedef struct _IXML_Document *Docptr;
typedef struct _IXML_Node *Nodeptr;
typedef struct _IXML_Node
{
DOMString nodeName;
DOMString nodeValue;
IXML_NODE_TYPE nodeType;
DOMString namespaceURI;
DOMString prefix;
DOMString localName;
BOOL readOnly;
Nodeptr parentNode;
Nodeptr firstChild;
Nodeptr prevSibling;
Nodeptr nextSibling;
Nodeptr firstAttr;
Docptr ownerDocument;
} IXML_Node;
typedef struct _IXML_Document
{
IXML_Node n;
} IXML_Document;
typedef struct _IXML_CDATASection
{
IXML_Node n;
} IXML_CDATASection;
typedef struct _IXML_Element
{
IXML_Node n;
DOMString tagName;
} IXML_Element;
typedef struct _IXML_ATTR
{
IXML_Node n;
BOOL specified;
IXML_Element *ownerElement;
} IXML_Attr;
typedef struct _IXML_Text
{
IXML_Node n;
} IXML_Text;
typedef struct _IXML_NodeList
{
IXML_Node *nodeItem;
struct _IXML_NodeList *next;
} IXML_NodeList;
typedef struct _IXML_NamedNodeMap
{
IXML_Node *nodeItem;
struct _IXML_NamedNodeMap *next;
} IXML_NamedNodeMap;
/* @} DOM Interfaces */
#ifdef __cplusplus
extern "C" {
#endif
EXPORT_SPEC const DOMString ixmlNode_getNodeName(
IXML_Node *nodeptr);
EXPORT_SPEC const DOMString ixmlNode_getNodeValue(
IXML_Node *nodeptr);
EXPORT_SPEC int ixmlNode_setNodeValue(
IXML_Node *nodeptr,
const char *newNodeValue);
EXPORT_SPEC unsigned short ixmlNode_getNodeType(
IXML_Node *nodeptr);
EXPORT_SPEC IXML_Node *ixmlNode_getParentNode(
IXML_Node *nodeptr);
EXPORT_SPEC IXML_NodeList *ixmlNode_getChildNodes(
IXML_Node *nodeptr);
EXPORT_SPEC IXML_Node *ixmlNode_getFirstChild(
IXML_Node *nodeptr);
EXPORT_SPEC IXML_Node *ixmlNode_getLastChild(
IXML_Node *nodeptr);
EXPORT_SPEC IXML_Node *ixmlNode_getPreviousSibling(
IXML_Node *nodeptr);
EXPORT_SPEC IXML_Node *ixmlNode_getNextSibling(
IXML_Node *nodeptr);
EXPORT_SPEC IXML_NamedNodeMap *ixmlNode_getAttributes(
IXML_Node *nodeptr);
EXPORT_SPEC IXML_Document *ixmlNode_getOwnerDocument(
IXML_Node *nodeptr);
EXPORT_SPEC const DOMString ixmlNode_getNamespaceURI(
IXML_Node *nodeptr);
EXPORT_SPEC const DOMString
ixmlNode_getPrefix(
IXML_Node *nodeptr);
EXPORT_SPEC const DOMString ixmlNode_getLocalName(
IXML_Node *nodeptr);
EXPORT_SPEC int ixmlNode_insertBefore(
IXML_Node *nodeptr,
IXML_Node * newChild,
IXML_Node * refChild);
EXPORT_SPEC int ixmlNode_replaceChild(
IXML_Node *nodeptr,
IXML_Node *newChild,
IXML_Node *oldChild,
IXML_Node **returnNode);
EXPORT_SPEC int ixmlNode_removeChild(
IXML_Node *nodeptr,
IXML_Node *oldChild,
IXML_Node **returnNode);
EXPORT_SPEC int ixmlNode_appendChild(
IXML_Node *nodeptr,
IXML_Node * newChild);
EXPORT_SPEC BOOL ixmlNode_hasChildNodes(
IXML_Node *nodeptr);
EXPORT_SPEC IXML_Node *ixmlNode_cloneNode(
IXML_Node *nodeptr,
BOOL deep);
EXPORT_SPEC BOOL ixmlNode_hasAttributes(
IXML_Node *nodeptr);
EXPORT_SPEC void ixmlNode_free(
IXML_Node *nodeptr);
/* @} Interface Node */
EXPORT_SPEC void ixmlAttr_free(
IXML_Attr *attrNode);
/* @} Interface Attr */
EXPORT_SPEC void ixmlCDATASection_init(
IXML_CDATASection *nodeptr);
EXPORT_SPEC void ixmlCDATASection_free(
IXML_CDATASection *nodeptr);
/* @} Interface CDATASection */
EXPORT_SPEC void ixmlDocument_init(
IXML_Document *nodeptr);
EXPORT_SPEC int ixmlDocument_createDocumentEx(
IXML_Document **doc);
EXPORT_SPEC IXML_Document *ixmlDocument_createDocument();
EXPORT_SPEC int ixmlDocument_createElementEx(
IXML_Document *doc,
const DOMString tagName,
IXML_Element **rtElement);
EXPORT_SPEC IXML_Element *ixmlDocument_createElement(
IXML_Document *doc,
const DOMString tagName);
EXPORT_SPEC int ixmlDocument_createTextNodeEx(
IXML_Document *doc,
const DOMString data,
IXML_Node **textNode);
EXPORT_SPEC IXML_Node *ixmlDocument_createTextNode(
IXML_Document *doc,
const DOMString data);
EXPORT_SPEC int ixmlDocument_createCDATASectionEx(
IXML_Document *doc,
const DOMString data,
IXML_CDATASection** cdNode);
EXPORT_SPEC IXML_CDATASection *ixmlDocument_createCDATASection(
IXML_Document *doc,
const DOMString data);
EXPORT_SPEC IXML_Attr *ixmlDocument_createAttribute(
IXML_Document *doc,
const char *name);
EXPORT_SPEC int ixmlDocument_createAttributeEx(
IXML_Document *doc,
const char *name,
IXML_Attr **attrNode);
EXPORT_SPEC IXML_NodeList *ixmlDocument_getElementsByTagName(
IXML_Document *doc,
const DOMString tagName);
/*
* introduced in DOM level 2
*/
EXPORT_SPEC int ixmlDocument_createElementNSEx(
IXML_Document *doc,
const DOMString namespaceURI,
const DOMString qualifiedName,
IXML_Element **rtElement);
EXPORT_SPEC IXML_Element *ixmlDocument_createElementNS(
IXML_Document *doc,
const DOMString namespaceURI,
const DOMString qualifiedName);
EXPORT_SPEC int ixmlDocument_createAttributeNSEx(
IXML_Document *doc,
const DOMString namespaceURI,
const DOMString qualifiedName,
IXML_Attr **attrNode);
EXPORT_SPEC IXML_Attr *ixmlDocument_createAttributeNS(
IXML_Document *doc,
const DOMString namespaceURI,
const DOMString qualifiedName);
EXPORT_SPEC IXML_NodeList *ixmlDocument_getElementsByTagNameNS(
IXML_Document *doc,
const DOMString namespaceURI,
const DOMString localName);
EXPORT_SPEC IXML_Element *ixmlDocument_getElementById(
IXML_Document *doc,
const DOMString tagName);
EXPORT_SPEC void ixmlDocument_free(
IXML_Document *doc);
EXPORT_SPEC int ixmlDocument_importNode(
IXML_Document *doc,
IXML_Node * importNode,
BOOL deep,
IXML_Node **rtNode);
/* @} Interface Document */
EXPORT_SPEC void ixmlElement_init(
IXML_Element *element);
EXPORT_SPEC const DOMString ixmlElement_getTagName(
IXML_Element *element);
EXPORT_SPEC const DOMString ixmlElement_getAttribute(
IXML_Element* element,
const DOMString name);
EXPORT_SPEC int ixmlElement_setAttribute(
IXML_Element *element,
const DOMString name,
const DOMString value);
EXPORT_SPEC int ixmlElement_removeAttribute(
IXML_Element *element,
const DOMString name);
EXPORT_SPEC IXML_Attr *ixmlElement_getAttributeNode(
IXML_Element *element,
const DOMString name);
EXPORT_SPEC int ixmlElement_setAttributeNode(
IXML_Element *element,
IXML_Attr* newAttr,
IXML_Attr** rtAttr);
EXPORT_SPEC int ixmlElement_removeAttributeNode(
IXML_Element *element,
IXML_Attr* oldAttr,
IXML_Attr** rtAttr);
EXPORT_SPEC IXML_NodeList *ixmlElement_getElementsByTagName(
IXML_Element *element,
const DOMString tagName);
/*
* Introduced in DOM 2
*/
EXPORT_SPEC const DOMString ixmlElement_getAttributeNS(
IXML_Element *element,
const DOMString namespaceURI,
const DOMString localname);
EXPORT_SPEC int ixmlElement_setAttributeNS(
IXML_Element *element,
const DOMString namespaceURI,
const DOMString qualifiedName,
const DOMString value);
EXPORT_SPEC int ixmlElement_removeAttributeNS(
IXML_Element *element,
const DOMString namespaceURI,
const DOMString localName);
EXPORT_SPEC IXML_Attr *ixmlElement_getAttributeNodeNS(
IXML_Element *element,
const DOMString namespaceURI,
const DOMString localName);
EXPORT_SPEC int ixmlElement_setAttributeNodeNS(
IXML_Element *element,
IXML_Attr *newAttr,
IXML_Attr **rcAttr);
EXPORT_SPEC IXML_NodeList *ixmlElement_getElementsByTagNameNS(
IXML_Element *element,
const DOMString namespaceURI,
const DOMString localName);
EXPORT_SPEC BOOL ixmlElement_hasAttribute(
IXML_Element *element,
const DOMString name);
EXPORT_SPEC BOOL ixmlElement_hasAttributeNS(
IXML_Element *element,
const DOMString namespaceURI,
const DOMString localName);
EXPORT_SPEC void ixmlElement_free(
IXML_Element *element);
/* @} Interface Element */
EXPORT_SPEC unsigned long ixmlNamedNodeMap_getLength(
IXML_NamedNodeMap *nnMap);
EXPORT_SPEC IXML_Node *ixmlNamedNodeMap_getNamedItem(
IXML_NamedNodeMap *nnMap,
const DOMString name);
EXPORT_SPEC IXML_Node *ixmlNamedNodeMap_setNamedItem(
IXML_NamedNodeMap *nnMap,
IXML_Node *arg);
EXPORT_SPEC IXML_Node *ixmlNamedNodeMap_removeNamedItem(
IXML_NamedNodeMap *nnMap,
const DOMString name);
EXPORT_SPEC IXML_Node *ixmlNamedNodeMap_item(
IXML_NamedNodeMap *nnMap,
unsigned long index);
/*
* Introduced in DOM level 2
*/
EXPORT_SPEC IXML_Node *ixmlNamedNodeMap_getNamedItemNS(
IXML_NamedNodeMap *nnMap,
const DOMString *namespaceURI,
const DOMString localName);
EXPORT_SPEC IXML_Node *ixmlNamedNodeMap_setNamedItemNS(
IXML_NamedNodeMap *nnMap,
IXML_Node *arg);
EXPORT_SPEC IXML_Node *ixmlNamedNodeMap_removeNamedItemNS(
IXML_NamedNodeMap *nnMap,
const DOMString namespaceURI,
const DOMString localName);
EXPORT_SPEC void ixmlNamedNodeMap_free(
IXML_NamedNodeMap *nnMap);
/* @} Interface NodeMap */
EXPORT_SPEC IXML_Node *ixmlNodeList_item(
IXML_NodeList *nList,
unsigned long index);
EXPORT_SPEC unsigned long ixmlNodeList_length(
IXML_NodeList *nList);
EXPORT_SPEC void ixmlNodeList_free(
IXML_NodeList *nList);
/* @} Interface NodeList */
EXPORT_SPEC DOMString ixmlPrintDocument(
IXML_Document *doc);
EXPORT_SPEC DOMString ixmlPrintNode(
IXML_Node *doc
);
EXPORT_SPEC DOMString ixmlDocumenttoString(
IXML_Document *doc);
EXPORT_SPEC DOMString ixmlNodetoString(
IXML_Node *doc);
EXPORT_SPEC void ixmlRelaxParser(
char errorChar);
EXPORT_SPEC IXML_Document *ixmlParseBuffer(
const char *buffer);
EXPORT_SPEC int ixmlParseBufferEx(
const char *buffer,
IXML_Document** doc);
EXPORT_SPEC IXML_Document *ixmlLoadDocument(
const char* xmlFile);
EXPORT_SPEC int ixmlLoadDocumentEx(
const char *xmlFile,
IXML_Document **doc);
EXPORT_SPEC DOMString ixmlCloneDOMString(
const DOMString src);
EXPORT_SPEC void ixmlFreeDOMString(
DOMString buf);
/* @} IXML API */
#ifdef __cplusplus
}
#endif
/* @} XMLAPI XML API */
#endif /* IXML_H */