libUPnP  1.8.0
ixmlparser.h
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * Copyright (c) 2000-2003 Intel Corporation
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *
9  * - Redistributions of source code must retain the above copyright notice,
10  * this list of conditions and the following disclaimer.
11  * - Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  * - Neither name of Intel Corporation nor the names of its contributors
15  * may be used to endorse or promote products derived from this software
16  * without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
22  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  **************************************************************************/
31 
32 
33 #ifndef IXMLPARSER_H
34 #define IXMLPARSER_H
35 
36 
42 #include "ixml.h"
43 #include "ixmlmembuf.h"
44 
45 
46 /* Parser definitions */
47 #define QUOT """
48 #define LT "<"
49 #define GT ">"
50 #define APOS "'"
51 #define AMP "&"
52 #define ESC_HEX "&#x"
53 #define ESC_DEC "&#"
54 
55 
56 typedef struct _IXML_NamespaceURI
57 {
58  char *nsURI;
59  char *prefix;
60  struct _IXML_NamespaceURI *nextNsURI;
62 
63 
64 typedef struct _IXML_ElementStack
65 {
66  char *element;
67  char *prefix;
68  char *namespaceUri;
69  IXML_NamespaceURI *pNsURI;
70  struct _IXML_ElementStack *nextElement;
72 
73 
74 typedef enum
75 {
76  eELEMENT,
77  eATTRIBUTE,
78  eCONTENT,
79 } PARSER_STATE;
80 
81 
82 typedef struct _Parser
83 {
85  char *dataBuffer;
87  char *curPtr;
89  char *savePtr;
90  ixml_membuf lastElem;
91  ixml_membuf tokenBuf;
92  IXML_Node *pNeedPrefixNode;
93  IXML_ElementStack *pCurElement;
94  IXML_Node *currentNodePtr;
95  PARSER_STATE state;
96  BOOL bHasTopLevel;
97 } Parser;
98 
99 
105  const DOMString name);
106 
107 
121  char c);
122 
123 
129  IXML_Node *IXML_Nodeptr);
130 
131 int Parser_LoadDocument(IXML_Document **retDoc, const char * xmlFile, BOOL file);
132 
133 int Parser_setNodePrefixAndLocalName(IXML_Node *newIXML_NodeIXML_Attr);
134 
135 
136 void ixmlAttr_init(IXML_Attr *attrNode);
137 
149  IXML_Element *element,
151  const char *tagName);
152 
153 
159  IXML_NamedNodeMap *nnMap);
160 
161 
168  /* [in] The named node map. */
169  IXML_NamedNodeMap **nnMap,
170  /* [in] The node to add. */
171  IXML_Node *add);
172 
178  IXML_NodeList **nList,
180  IXML_Node *add);
181 
182 
186 void ixmlNode_init(
188  IN IXML_Node *nodeptr);
189 
190 
199 BOOL ixmlNode_compare(
201  IXML_Node *srcNode,
203  IXML_Node *destNode);
204 
205 
213  IXML_Node *n,
215  const char *tagname,
217  IXML_NodeList **list);
218 
219 
227  IXML_Node *n,
229  const char *namespaceURI,
231  const char *localName,
233  IXML_NodeList **list);
234 
235 
243  IXML_Node *node,
245  const DOMString qualifiedName);
246 
247 
255  IXML_Node *destNode,
257  IXML_Node *src);
258 
259 
263 void ixmlNodeList_init(
265  IXML_NodeList *nList);
266 
267 
268 #endif /* IXMLPARSER_H */
269