libUPnP
1.8.0
|
00001 /************************************************************************** 00002 * 00003 * Copyright (c) 2000-2003 Intel Corporation 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions are met: 00008 * 00009 * - Redistributions of source code must retain the above copyright notice, 00010 * this list of conditions and the following disclaimer. 00011 * - Redistributions in binary form must reproduce the above copyright notice, 00012 * this list of conditions and the following disclaimer in the documentation 00013 * and/or other materials provided with the distribution. 00014 * - Neither name of Intel Corporation nor the names of its contributors 00015 * may be used to endorse or promote products derived from this software 00016 * without specific prior written permission. 00017 * 00018 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00019 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00020 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00021 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR 00022 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00023 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00024 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00025 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00026 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00027 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00028 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00029 * 00030 **************************************************************************/ 00031 00032 00033 #ifndef IXML_H 00034 #define IXML_H 00035 00036 00046 #include "UpnpGlobal.h" /* For EXPORT_SPEC */ 00047 00048 00049 typedef int BOOL; 00050 00051 00055 #define DOMString char * 00056 /*typedef char *DOMString;*/ 00057 00058 00059 #ifndef TRUE 00060 #define TRUE 1 00061 #endif 00062 00063 #ifndef FALSE 00064 #define FALSE 0 00065 #endif 00066 00067 #ifndef IN 00068 #define IN 00069 #endif 00070 00071 #ifndef OUT 00072 #define OUT 00073 #endif 00074 00075 #ifndef INOUT 00076 #define INOUT 00077 #endif 00078 00079 00099 typedef enum { 00100 eINVALID_NODE = 0, 00101 eELEMENT_NODE = 1, 00102 eATTRIBUTE_NODE = 2, 00103 eTEXT_NODE = 3, 00104 eCDATA_SECTION_NODE = 4, 00105 eENTITY_REFERENCE_NODE = 5, 00106 eENTITY_NODE = 6, 00107 ePROCESSING_INSTRUCTION_NODE = 7, 00108 eCOMMENT_NODE = 8, 00109 eDOCUMENT_NODE = 9, 00110 eDOCUMENT_TYPE_NODE = 10, 00111 eDOCUMENT_FRAGMENT_NODE = 11, 00112 eNOTATION_NODE = 12, 00113 } IXML_NODE_TYPE; 00114 00115 00119 typedef enum { 00120 IXML_SUCCESS = 0, 00121 00122 IXML_INDEX_SIZE_ERR = 1, 00123 IXML_DOMSTRING_SIZE_ERR = 2, 00124 IXML_HIERARCHY_REQUEST_ERR = 3, 00125 IXML_WRONG_DOCUMENT_ERR = 4, 00126 IXML_INVALID_CHARACTER_ERR = 5, 00127 IXML_NO_DATA_ALLOWED_ERR = 6, 00128 IXML_NO_MODIFICATION_ALLOWED_ERR = 7, 00129 IXML_NOT_FOUND_ERR = 8, 00130 IXML_NOT_SUPPORTED_ERR = 9, 00131 IXML_INUSE_ATTRIBUTE_ERR = 10, 00132 IXML_INVALID_STATE_ERR = 11, 00133 IXML_SYNTAX_ERR = 12, 00134 IXML_INVALID_MODIFICATION_ERR = 13, 00135 IXML_NAMESPACE_ERR = 14, 00136 IXML_INVALID_ACCESS_ERR = 15, 00137 00138 IXML_NO_SUCH_FILE = 101, 00139 IXML_INSUFFICIENT_MEMORY = 102, 00140 IXML_FILE_DONE = 104, 00141 IXML_INVALID_PARAMETER = 105, 00142 IXML_FAILED = 106, 00143 IXML_INVALID_ITEM_NUMBER = 107, 00144 } IXML_ERRORCODE; 00145 00146 00147 #define DOCUMENTNODENAME "#document" 00148 #define TEXTNODENAME "#text" 00149 #define CDATANODENAME "#cdata-section" 00150 00151 00152 typedef struct _IXML_Document *Docptr; 00153 00154 00155 typedef struct _IXML_Node *Nodeptr; 00156 00157 00161 typedef struct _IXML_Node 00162 { 00163 DOMString nodeName; 00164 DOMString nodeValue; 00165 IXML_NODE_TYPE nodeType; 00166 DOMString namespaceURI; 00167 DOMString prefix; 00168 DOMString localName; 00169 BOOL readOnly; 00170 00171 Nodeptr parentNode; 00172 Nodeptr firstChild; 00173 Nodeptr prevSibling; 00174 Nodeptr nextSibling; 00175 Nodeptr firstAttr; 00176 Docptr ownerDocument; 00177 } IXML_Node; 00178 00179 00183 typedef struct _IXML_Document 00184 { 00185 IXML_Node n; 00186 } IXML_Document; 00187 00188 00192 typedef struct _IXML_CDATASection 00193 { 00194 IXML_Node n; 00195 } IXML_CDATASection; 00196 00197 00201 typedef struct _IXML_Element 00202 { 00203 IXML_Node n; 00204 DOMString tagName; 00205 } IXML_Element; 00206 00207 00211 typedef struct _IXML_ATTR 00212 { 00213 IXML_Node n; 00214 BOOL specified; 00215 IXML_Element *ownerElement; 00216 } IXML_Attr; 00217 00218 00222 typedef struct _IXML_Text 00223 { 00224 IXML_Node n; 00225 } IXML_Text; 00226 00227 00231 typedef struct _IXML_NodeList 00232 { 00233 IXML_Node *nodeItem; 00234 struct _IXML_NodeList *next; 00235 } IXML_NodeList; 00236 00237 00241 typedef struct _IXML_NamedNodeMap 00242 { 00243 IXML_Node *nodeItem; 00244 struct _IXML_NamedNodeMap *next; 00245 } IXML_NamedNodeMap; 00246 00247 /* @} DOM Interfaces */ 00248 00249 00250 00251 #ifdef __cplusplus 00252 extern "C" { 00253 #endif 00254 00255 00275 EXPORT_SPEC const DOMString ixmlNode_getNodeName( 00277 IXML_Node *nodeptr); 00278 00279 00288 EXPORT_SPEC const DOMString ixmlNode_getNodeValue( 00290 IXML_Node *nodeptr); 00291 00292 00305 EXPORT_SPEC int ixmlNode_setNodeValue( 00307 IXML_Node *nodeptr, 00309 const char *newNodeValue); 00310 00311 00317 EXPORT_SPEC unsigned short ixmlNode_getNodeType( 00319 IXML_Node *nodeptr); 00320 00321 00328 EXPORT_SPEC IXML_Node *ixmlNode_getParentNode( 00330 IXML_Node *nodeptr); 00331 00332 00342 EXPORT_SPEC IXML_NodeList *ixmlNode_getChildNodes( 00344 IXML_Node *nodeptr); 00345 00346 00353 EXPORT_SPEC IXML_Node *ixmlNode_getFirstChild( 00355 IXML_Node *nodeptr); 00356 00357 00364 EXPORT_SPEC IXML_Node *ixmlNode_getLastChild( 00366 IXML_Node *nodeptr); 00367 00368 00375 EXPORT_SPEC IXML_Node *ixmlNode_getPreviousSibling( 00377 IXML_Node *nodeptr); 00378 00379 00386 EXPORT_SPEC IXML_Node *ixmlNode_getNextSibling( 00388 IXML_Node *nodeptr); 00389 00390 00397 EXPORT_SPEC IXML_NamedNodeMap *ixmlNode_getAttributes( 00399 IXML_Node *nodeptr); 00400 00401 00412 EXPORT_SPEC IXML_Document *ixmlNode_getOwnerDocument( 00414 IXML_Node *nodeptr); 00415 00416 00426 EXPORT_SPEC const DOMString ixmlNode_getNamespaceURI( 00428 IXML_Node *nodeptr); 00429 00430 00441 EXPORT_SPEC const DOMString 00442 ixmlNode_getPrefix( 00444 IXML_Node *nodeptr); 00445 00446 00458 EXPORT_SPEC const DOMString ixmlNode_getLocalName( 00460 IXML_Node *nodeptr); 00461 00487 EXPORT_SPEC int ixmlNode_insertBefore( 00489 IXML_Node *nodeptr, 00491 IXML_Node * newChild, 00494 IXML_Node * refChild); 00495 00496 00519 EXPORT_SPEC int ixmlNode_replaceChild( 00521 IXML_Node *nodeptr, 00523 IXML_Node *newChild, 00525 IXML_Node *oldChild, 00527 IXML_Node **returnNode); 00528 00529 00546 EXPORT_SPEC int ixmlNode_removeChild( 00548 IXML_Node *nodeptr, 00550 IXML_Node *oldChild, 00552 IXML_Node **returnNode); 00553 00554 00572 EXPORT_SPEC int ixmlNode_appendChild( 00574 IXML_Node *nodeptr, 00576 IXML_Node * newChild); 00577 00578 00584 EXPORT_SPEC BOOL ixmlNode_hasChildNodes( 00586 IXML_Node *nodeptr); 00587 00588 00600 EXPORT_SPEC IXML_Node *ixmlNode_cloneNode( 00602 IXML_Node *nodeptr, 00605 BOOL deep); 00606 00607 00615 EXPORT_SPEC BOOL ixmlNode_hasAttributes( 00617 IXML_Node *nodeptr); 00618 00619 00623 EXPORT_SPEC void ixmlNode_free( 00625 IXML_Node *nodeptr); 00626 00627 /* @} Interface Node */ 00628 00629 00630 00648 EXPORT_SPEC void ixmlAttr_free( 00650 IXML_Attr *attrNode); 00651 00652 00653 /* @} Interface Attr */ 00654 00655 00656 00675 EXPORT_SPEC void ixmlCDATASection_init( 00677 IXML_CDATASection *nodeptr); 00678 00679 00683 EXPORT_SPEC void ixmlCDATASection_free( 00685 IXML_CDATASection *nodeptr); 00686 00687 00688 /* @} Interface CDATASection */ 00689 00690 00691 00709 EXPORT_SPEC void ixmlDocument_init( 00711 IXML_Document *nodeptr); 00712 00713 00726 EXPORT_SPEC int ixmlDocument_createDocumentEx( 00728 IXML_Document **doc); 00729 00730 00737 EXPORT_SPEC IXML_Document *ixmlDocument_createDocument(); 00738 00739 00758 EXPORT_SPEC int ixmlDocument_createElementEx( 00760 IXML_Document *doc, 00762 const DOMString tagName, 00764 IXML_Element **rtElement); 00765 00766 00778 EXPORT_SPEC IXML_Element *ixmlDocument_createElement( 00780 IXML_Document *doc, 00782 const DOMString tagName); 00783 00784 00799 EXPORT_SPEC int ixmlDocument_createTextNodeEx( 00801 IXML_Document *doc, 00804 const DOMString data, 00806 IXML_Node **textNode); 00807 00808 00814 EXPORT_SPEC IXML_Node *ixmlDocument_createTextNode( 00816 IXML_Document *doc, 00819 const DOMString data); 00820 00821 00836 EXPORT_SPEC int ixmlDocument_createCDATASectionEx( 00838 IXML_Document *doc, 00840 const DOMString data, 00842 IXML_CDATASection** cdNode); 00843 00844 00850 EXPORT_SPEC IXML_CDATASection *ixmlDocument_createCDATASection( 00852 IXML_Document *doc, 00854 const DOMString data); 00855 00856 00866 EXPORT_SPEC IXML_Attr *ixmlDocument_createAttribute( 00868 IXML_Document *doc, 00870 const char *name); 00871 00872 00887 EXPORT_SPEC int ixmlDocument_createAttributeEx( 00889 IXML_Document *doc, 00891 const char *name, 00893 IXML_Attr **attrNode); 00894 00895 00904 EXPORT_SPEC IXML_NodeList *ixmlDocument_getElementsByTagName( 00906 IXML_Document *doc, 00908 const DOMString tagName); 00909 00910 00911 /* 00912 * introduced in DOM level 2 00913 */ 00914 00915 00931 EXPORT_SPEC int ixmlDocument_createElementNSEx( 00933 IXML_Document *doc, 00935 const DOMString namespaceURI, 00937 const DOMString qualifiedName, 00939 IXML_Element **rtElement); 00940 00941 00950 EXPORT_SPEC IXML_Element *ixmlDocument_createElementNS( 00952 IXML_Document *doc, 00954 const DOMString namespaceURI, 00956 const DOMString qualifiedName); 00957 00958 00974 EXPORT_SPEC int ixmlDocument_createAttributeNSEx( 00976 IXML_Document *doc, 00978 const DOMString namespaceURI, 00980 const DOMString qualifiedName, 00982 IXML_Attr **attrNode); 00983 00984 00993 EXPORT_SPEC IXML_Attr *ixmlDocument_createAttributeNS( 00995 IXML_Document *doc, 00997 const DOMString namespaceURI, 00999 const DOMString qualifiedName); 01000 01001 01013 EXPORT_SPEC IXML_NodeList *ixmlDocument_getElementsByTagNameNS( 01015 IXML_Document *doc, 01018 const DOMString namespaceURI, 01021 const DOMString localName); 01022 01023 01029 EXPORT_SPEC IXML_Element *ixmlDocument_getElementById( 01031 IXML_Document *doc, 01033 const DOMString tagName); 01034 01035 01043 EXPORT_SPEC void ixmlDocument_free( 01045 IXML_Document *doc); 01046 01047 01078 EXPORT_SPEC int ixmlDocument_importNode( 01080 IXML_Document *doc, 01082 IXML_Node * importNode, 01085 BOOL deep, 01087 IXML_Node **rtNode); 01088 01089 01090 /* @} Interface Document */ 01091 01092 01093 01094 01111 EXPORT_SPEC void ixmlElement_init( 01113 IXML_Element *element); 01114 01115 01121 EXPORT_SPEC const DOMString ixmlElement_getTagName( 01123 IXML_Element *element); 01124 01125 01132 EXPORT_SPEC const DOMString ixmlElement_getAttribute( 01134 IXML_Element* element, 01136 const DOMString name); 01137 01138 01155 EXPORT_SPEC int ixmlElement_setAttribute( 01157 IXML_Element *element, 01159 const DOMString name, 01162 const DOMString value); 01163 01164 01173 EXPORT_SPEC int ixmlElement_removeAttribute( 01175 IXML_Element *element, 01177 const DOMString name); 01178 01179 01188 EXPORT_SPEC IXML_Attr *ixmlElement_getAttributeNode( 01190 IXML_Element *element, 01192 const DOMString name); 01193 01194 01212 EXPORT_SPEC int ixmlElement_setAttributeNode( 01214 IXML_Element *element, 01216 IXML_Attr* newAttr, 01219 IXML_Attr** rtAttr); 01220 01221 01232 EXPORT_SPEC int ixmlElement_removeAttributeNode( 01234 IXML_Element *element, 01236 IXML_Attr* oldAttr, 01238 IXML_Attr** rtAttr); 01239 01240 01248 EXPORT_SPEC IXML_NodeList *ixmlElement_getElementsByTagName( 01250 IXML_Element *element, 01252 const DOMString tagName); 01253 01254 01255 /* 01256 * Introduced in DOM 2 01257 */ 01258 01259 01266 EXPORT_SPEC const DOMString ixmlElement_getAttributeNS( 01268 IXML_Element *element, 01270 const DOMString namespaceURI, 01272 const DOMString localname); 01273 01274 01297 EXPORT_SPEC int ixmlElement_setAttributeNS( 01299 IXML_Element *element, 01301 const DOMString namespaceURI, 01303 const DOMString qualifiedName, 01305 const DOMString value); 01306 01307 01319 EXPORT_SPEC int ixmlElement_removeAttributeNS( 01321 IXML_Element *element, 01323 const DOMString namespaceURI, 01325 const DOMString localName); 01326 01327 01334 EXPORT_SPEC IXML_Attr *ixmlElement_getAttributeNodeNS( 01336 IXML_Element *element, 01338 const DOMString namespaceURI, 01340 const DOMString localName); 01341 01342 01363 EXPORT_SPEC int ixmlElement_setAttributeNodeNS( 01365 IXML_Element *element, 01367 IXML_Attr *newAttr, 01369 IXML_Attr **rcAttr); 01370 01371 01379 EXPORT_SPEC IXML_NodeList *ixmlElement_getElementsByTagNameNS( 01381 IXML_Element *element, 01384 const DOMString namespaceURI, 01387 const DOMString localName); 01388 01389 01397 EXPORT_SPEC BOOL ixmlElement_hasAttribute( 01399 IXML_Element *element, 01401 const DOMString name); 01402 01403 01411 EXPORT_SPEC BOOL ixmlElement_hasAttributeNS( 01413 IXML_Element *element, 01415 const DOMString namespaceURI, 01417 const DOMString localName); 01418 01419 01423 EXPORT_SPEC void ixmlElement_free( 01425 IXML_Element *element); 01426 01427 01428 /* @} Interface Element */ 01429 01430 01431 01449 EXPORT_SPEC unsigned long ixmlNamedNodeMap_getLength( 01451 IXML_NamedNodeMap *nnMap); 01452 01453 01460 EXPORT_SPEC IXML_Node *ixmlNamedNodeMap_getNamedItem( 01462 IXML_NamedNodeMap *nnMap, 01464 const DOMString name); 01465 01466 01474 EXPORT_SPEC IXML_Node *ixmlNamedNodeMap_setNamedItem( 01476 IXML_NamedNodeMap *nnMap, 01478 IXML_Node *arg); 01479 01480 01486 EXPORT_SPEC IXML_Node *ixmlNamedNodeMap_removeNamedItem( 01488 IXML_NamedNodeMap *nnMap, 01490 const DOMString name); 01491 01492 01500 EXPORT_SPEC IXML_Node *ixmlNamedNodeMap_item( 01502 IXML_NamedNodeMap *nnMap, 01504 unsigned long index); 01505 01506 01507 /* 01508 * Introduced in DOM level 2 01509 */ 01510 01511 01518 EXPORT_SPEC IXML_Node *ixmlNamedNodeMap_getNamedItemNS( 01520 IXML_NamedNodeMap *nnMap, 01522 const DOMString *namespaceURI, 01524 const DOMString localName); 01525 01526 01534 EXPORT_SPEC IXML_Node *ixmlNamedNodeMap_setNamedItemNS( 01536 IXML_NamedNodeMap *nnMap, 01538 IXML_Node *arg); 01539 01540 01547 EXPORT_SPEC IXML_Node *ixmlNamedNodeMap_removeNamedItemNS( 01549 IXML_NamedNodeMap *nnMap, 01551 const DOMString namespaceURI, 01553 const DOMString localName); 01554 01555 01560 EXPORT_SPEC void ixmlNamedNodeMap_free( 01562 IXML_NamedNodeMap *nnMap); 01563 01564 01565 /* @} Interface NodeMap */ 01566 01567 01568 01587 EXPORT_SPEC IXML_Node *ixmlNodeList_item( 01589 IXML_NodeList *nList, 01591 unsigned long index); 01592 01593 01599 EXPORT_SPEC unsigned long ixmlNodeList_length( 01601 IXML_NodeList *nList); 01602 01603 01610 EXPORT_SPEC void ixmlNodeList_free( 01612 IXML_NodeList *nList); 01613 01614 01615 /* @} Interface NodeList */ 01616 01617 01618 01652 EXPORT_SPEC DOMString ixmlPrintDocument( 01654 IXML_Document *doc); 01655 01656 01674 EXPORT_SPEC DOMString ixmlPrintNode( 01676 IXML_Node *doc 01677 ); 01678 01679 01698 EXPORT_SPEC DOMString ixmlDocumenttoString( 01700 IXML_Document *doc); 01701 01702 01717 EXPORT_SPEC DOMString ixmlNodetoString( 01719 IXML_Node *doc); 01720 01721 01725 EXPORT_SPEC void ixmlRelaxParser( 01734 char errorChar); 01735 01736 01742 EXPORT_SPEC IXML_Document *ixmlParseBuffer( 01744 const char *buffer); 01745 01746 01761 EXPORT_SPEC int ixmlParseBufferEx( 01763 const char *buffer, 01765 IXML_Document** doc); 01766 01767 01773 EXPORT_SPEC IXML_Document *ixmlLoadDocument( 01775 const char* xmlFile); 01776 01777 01792 EXPORT_SPEC int ixmlLoadDocumentEx( 01794 const char *xmlFile, 01797 IXML_Document **doc); 01798 01799 01806 EXPORT_SPEC DOMString ixmlCloneDOMString( 01808 const DOMString src); 01809 01810 01814 EXPORT_SPEC void ixmlFreeDOMString( 01816 DOMString buf); 01817 01818 01819 /* @} IXML API */ 01820 01821 01822 #ifdef __cplusplus 01823 } 01824 #endif 01825 01826 01827 /* @} XMLAPI XML API */ 01828 01829 01830 #endif /* IXML_H */ 01831