libUPnP 1.8.4
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
56typedef struct _IXML_NamespaceURI
57{
58 char *nsURI;
59 char *prefix;
60 struct _IXML_NamespaceURI *nextNsURI;
62
63
64typedef struct _IXML_ElementStack
65{
66 char *element;
67 char *prefix;
68 char *namespaceUri;
69 IXML_NamespaceURI *pNsURI;
70 struct _IXML_ElementStack *nextElement;
72
73
74typedef enum
75{
76 eELEMENT,
77 eATTRIBUTE,
78 eCONTENT,
79} PARSER_STATE;
80
81
82typedef struct _Parser
83{
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#ifdef IXML_HAVE_SCRIPTSUPPORT
132void Parser_setBeforeFree(
134 IXML_BeforeFreeNode_t hndlr);
135
139IXML_BeforeFreeNode_t Parser_getBeforeFree();
140#endif
141
142
148 IXML_Node *IXML_Nodeptr);
149
150int Parser_LoadDocument(IXML_Document **retDoc, const char * xmlFile, BOOL file);
151
152int Parser_setNodePrefixAndLocalName(IXML_Node *newIXML_NodeIXML_Attr);
153
154
155void ixmlAttr_init(IXML_Attr *attrNode);
156
168 IXML_Element *element,
170 const char *tagName);
171
172
178 IXML_NamedNodeMap *nnMap);
179
180
187 /* [in] The named node map. */
188 IXML_NamedNodeMap **nnMap,
189 /* [in] The node to add. */
190 IXML_Node *add);
191
197 IXML_NodeList **nList,
199 IXML_Node *add);
200
201
207 IN IXML_Node *nodeptr);
208
209
220 IXML_Node *srcNode,
222 IXML_Node *destNode);
223
224
232 IXML_Node *n,
234 const char *tagname,
236 IXML_NodeList **list);
237
238
246 IXML_Node *n,
248 const char *namespaceURI,
250 const char *localName,
252 IXML_NodeList **list);
253
254
262 IXML_Node *node,
264 const DOMString qualifiedName);
265
266
274 IXML_Node *destNode,
276 IXML_Node *src);
277
278
284 IXML_NodeList *nList);
285
286
287#endif /* IXMLPARSER_H */
288
#define DOMString
The type of DOM strings.
Definition: ixml.h:59
int ixmlNodeList_addToNodeList(IXML_NodeList **nList, IXML_Node *add)
Add a node to nodelist.
Definition: nodeList.c:82
BOOL Parser_isValidXmlName(const DOMString name)
Check to see whether name is a valid xml name.
Definition: ixmlparser.c:2477
void ixmlNamedNodeMap_init(IXML_NamedNodeMap *nnMap)
Initializes a NamedNodeMap object.
Definition: namedNodeMap.c:77
int ixmlNode_setNodeProperties(IXML_Node *destNode, IXML_Node *src)
Definition: node.c:1340
BOOL ixmlNode_compare(IXML_Node *srcNode, IXML_Node *destNode)
Compare two nodes to see whether they are the same node. Parent, sibling and children node are ignore...
Definition: node.c:470
void ixmlNode_getElementsByTagName(IXML_Node *n, const char *tagname, IXML_NodeList **list)
Returns a nodeList of all descendant Elements with a given tagName, in the order in which they are en...
Definition: node.c:1226
int ixmlNode_setNodeName(IXML_Node *node, const DOMString qualifiedName)
Definition: node.c:1310
void ixmlNode_init(IN IXML_Node *nodeptr)
Intializes a node.
int Parser_LoadDocument(IXML_Document **retDoc, const char *xmlFile, BOOL file)
Parses a xml file and return the DOM tree.
Definition: ixmlparser.c:2595
void ixmlNodeList_init(IXML_NodeList *nList)
Initializes a nodelist.
Definition: nodeList.c:46
void Parser_freeNodeContent(IXML_Node *IXML_Nodeptr)
Fees a node contents.
Definition: ixmlparser.c:2626
int ixmlElement_setTagName(IXML_Element *element, const char *tagName)
Set the given element's tagName.
Definition: element.c:64
int Parser_setNodePrefixAndLocalName(IXML_Node *newIXML_NodeIXML_Attr)
Set the node prefix and localName as defined by the nodeName in the form of ns:name.
Definition: ixmlparser.c:2658
void Parser_setErrorChar(char c)
Sets the error character.
Definition: ixmlparser.c:2500
int ixmlNamedNodeMap_addToNamedNodeMap(IXML_NamedNodeMap **nnMap, IXML_Node *add)
Add a node to a NamedNodeMap.
Definition: namedNodeMap.c:156
void ixmlNode_getElementsByTagNameNS(IXML_Node *n, const char *namespaceURI, const char *localName, IXML_NodeList **list)
Returns a nodeList of all the descendant Elements with a given local name and namespace URI in the or...
Definition: node.c:1282
Data structure representing an Attribute node.
Definition: ixml.h:226
Data structure representing the DOM Document.
Definition: ixml.h:198
Definition: ixmlparser.h:65
Data structure representing an Element node.
Definition: ixml.h:216
Data structure representing a list of named nodes.
Definition: ixml.h:256
Definition: ixmlparser.h:57
Data structure representing a list of nodes.
Definition: ixml.h:246
Data structure common to all types of nodes.
Definition: ixml.h:173
Definition: ixmlparser.h:83
char * curPtr
Definition: ixmlparser.h:87
char * dataBuffer
Definition: ixmlparser.h:85
char * savePtr
Definition: ixmlparser.h:89
The ixml_membuf type.
Definition: ixmlmembuf.h:60