libUPnP
1.6.17
|
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 IXMLPARSER_H 00034 #define IXMLPARSER_H 00035 00036 00042 #include "ixml.h" 00043 #include "ixmlmembuf.h" 00044 00045 00046 /* Parser definitions */ 00047 #define QUOT """ 00048 #define LT "<" 00049 #define GT ">" 00050 #define APOS "'" 00051 #define AMP "&" 00052 #define ESC_HEX "&#x" 00053 #define ESC_DEC "&#" 00054 00055 00056 typedef struct _IXML_NamespaceURI 00057 { 00058 char *nsURI; 00059 char *prefix; 00060 struct _IXML_NamespaceURI *nextNsURI; 00061 } IXML_NamespaceURI; 00062 00063 00064 typedef struct _IXML_ElementStack 00065 { 00066 char *element; 00067 char *prefix; 00068 char *namespaceUri; 00069 IXML_NamespaceURI *pNsURI; 00070 struct _IXML_ElementStack *nextElement; 00071 } IXML_ElementStack; 00072 00073 00074 typedef enum 00075 { 00076 eELEMENT, 00077 eATTRIBUTE, 00078 eCONTENT, 00079 } PARSER_STATE; 00080 00081 00082 typedef struct _Parser 00083 { 00085 char *dataBuffer; 00087 char *curPtr; 00089 char *savePtr; 00090 ixml_membuf lastElem; 00091 ixml_membuf tokenBuf; 00092 IXML_Node *pNeedPrefixNode; 00093 IXML_ElementStack *pCurElement; 00094 IXML_Node *currentNodePtr; 00095 PARSER_STATE state; 00096 BOOL bHasTopLevel; 00097 } Parser; 00098 00099 00103 BOOL Parser_isValidXmlName( 00105 const DOMString name); 00106 00107 00119 void Parser_setErrorChar( 00121 char c); 00122 00123 00127 void Parser_freeNodeContent( 00129 IXML_Node *IXML_Nodeptr); 00130 00131 int Parser_LoadDocument(IXML_Document **retDoc, const char * xmlFile, BOOL file); 00132 00133 int Parser_setNodePrefixAndLocalName(IXML_Node *newIXML_NodeIXML_Attr); 00134 00135 00136 void ixmlAttr_init(IXML_Attr *attrNode); 00137 00147 int ixmlElement_setTagName( 00149 IXML_Element *element, 00151 const char *tagName); 00152 00153 00157 void ixmlNamedNodeMap_init( 00159 IXML_NamedNodeMap *nnMap); 00160 00161 00167 int ixmlNamedNodeMap_addToNamedNodeMap( 00168 /* [in] The named node map. */ 00169 IXML_NamedNodeMap **nnMap, 00170 /* [in] The node to add. */ 00171 IXML_Node *add); 00172 00176 int ixmlNodeList_addToNodeList( 00178 IXML_NodeList **nList, 00180 IXML_Node *add); 00181 00182 00186 void ixmlNode_init( 00188 IN IXML_Node *nodeptr); 00189 00190 00199 BOOL ixmlNode_compare( 00201 IXML_Node *srcNode, 00203 IXML_Node *destNode); 00204 00205 00211 void ixmlNode_getElementsByTagName( 00213 IXML_Node *n, 00215 const char *tagname, 00217 IXML_NodeList **list); 00218 00219 00225 void ixmlNode_getElementsByTagNameNS( 00227 IXML_Node *n, 00229 const char *namespaceURI, 00231 const char *localName, 00233 IXML_NodeList **list); 00234 00235 00241 int ixmlNode_setNodeName( 00243 IXML_Node *node, 00245 const DOMString qualifiedName); 00246 00247 00253 int ixmlNode_setNodeProperties( 00255 IXML_Node *destNode, 00257 IXML_Node *src); 00258 00259 00263 void ixmlNodeList_init( 00265 IXML_NodeList *nList); 00266 00267 00268 #endif /* IXMLPARSER_H */ 00269