libUPnP 1.14.19
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#ifndef IXMLPARSER_H
33#define IXMLPARSER_H
34
39#include "ixml.h"
40#include "ixmlmembuf.h"
41
42/* Parser definitions */
43#define QUOT """
44#define LT "<"
45#define GT ">"
46#define APOS "'"
47#define AMP "&"
48#define ESC_HEX "&#x"
49#define ESC_DEC "&#"
50
51typedef struct _IXML_NamespaceURI
52{
53 char *nsURI;
54 char *prefix;
55 struct _IXML_NamespaceURI *nextNsURI;
57
58typedef struct _IXML_ElementStack
59{
60 char *element;
61 char *prefix;
62 char *namespaceUri;
63 IXML_NamespaceURI *pNsURI;
64 struct _IXML_ElementStack *nextElement;
66
67typedef enum
68{
69 eELEMENT,
70 eATTRIBUTE,
71 eCONTENT
72} PARSER_STATE;
73
74typedef struct _Parser
75{
79 char *curPtr;
81 char *savePtr;
82 ixml_membuf lastElem;
83 ixml_membuf tokenBuf;
84 IXML_Node *pNeedPrefixNode;
85 IXML_ElementStack *pCurElement;
86 IXML_Node *currentNodePtr;
87 PARSER_STATE state;
88 int bHasTopLevel;
89} Parser;
90
96 const DOMString name);
97
111 char c);
112
113#ifdef IXML_HAVE_SCRIPTSUPPORT
122void Parser_setBeforeFree(
124 IXML_BeforeFreeNode_t hndlr);
125
129IXML_BeforeFreeNode_t Parser_getBeforeFree(void);
130#endif
131
137 IXML_Node *IXML_Nodeptr);
138
139int Parser_LoadDocument(IXML_Document **retDoc, const char *xmlFile, int file);
140
141int Parser_setNodePrefixAndLocalName(IXML_Node *newIXML_NodeIXML_Attr);
142
143void ixmlAttr_init(IXML_Attr *attrNode);
144
156 IXML_Element *element,
158 const char *tagName);
159
165 IXML_NamedNodeMap *nnMap);
166
173 /* [in] The named node map. */
174 IXML_NamedNodeMap **nnMap,
175 /* [in] The node to add. */
176 IXML_Node *add);
177
183 IXML_NodeList **nList,
185 IXML_Node *add);
186
190void ixmlNode_init(
192 IXML_Node *nodeptr);
193
204 IXML_Node *srcNode,
206 IXML_Node *destNode);
207
215 IXML_Node *n,
217 const char *tagname,
219 IXML_NodeList **list);
220
228 IXML_Node *n,
230 const char *namespaceURI,
232 const char *localName,
234 IXML_NodeList **list);
235
243 IXML_Node *node,
245 const DOMString qualifiedName);
246
254 IXML_Node *destNode,
256 IXML_Node *src);
257
263 IXML_NodeList *nList);
264
265#endif /* IXMLPARSER_H */
#define DOMString
The type of DOM strings.
Definition ixml.h:48
int ixmlNodeList_addToNodeList(IXML_NodeList **nList, IXML_Node *add)
Add a node to nodelist.
Definition nodeList.c:75
void ixmlNamedNodeMap_init(IXML_NamedNodeMap *nnMap)
Initializes a NamedNodeMap object.
Definition namedNodeMap.c:72
int ixmlNode_setNodeProperties(IXML_Node *destNode, IXML_Node *src)
Definition node.c:1384
int 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:518
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:1272
void ixmlNode_init(IXML_Node *nodeptr)
Intializes a node.
Definition node.c:45
int ixmlNode_setNodeName(IXML_Node *node, const DOMString qualifiedName)
Definition node.c:1357
void ixmlNodeList_init(IXML_NodeList *nList)
Initializes a nodelist.
Definition nodeList.c:42
void Parser_freeNodeContent(IXML_Node *IXML_Nodeptr)
Fees a node contents.
Definition ixmlparser.c:2817
int ixmlElement_setTagName(IXML_Element *element, const char *tagName)
Set the given element's tagName.
Definition element.c:61
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:2848
int Parser_LoadDocument(IXML_Document **retDoc, const char *xmlFile, int file)
Parses a xml file and return the DOM tree.
Definition ixmlparser.c:2788
void Parser_setErrorChar(char c)
Sets the error character.
Definition ixmlparser.c:2691
int ixmlNamedNodeMap_addToNamedNodeMap(IXML_NamedNodeMap **nnMap, IXML_Node *add)
Add a node to a NamedNodeMap.
Definition namedNodeMap.c:145
int Parser_isValidXmlName(const DOMString name)
Check to see whether name is a valid xml name.
Definition ixmlparser.c:2669
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:1331
Data structure representing an Attribute node.
Definition ixml.h:185
Data structure representing the DOM Document.
Definition ixml.h:160
Definition ixmlparser.h:59
Data structure representing an Element node.
Definition ixml.h:176
Data structure representing a list of named nodes.
Definition ixml.h:212
Definition ixmlparser.h:52
Data structure representing a list of nodes.
Definition ixml.h:203
Data structure common to all types of nodes.
Definition ixml.h:136
Definition ixmlparser.h:75
char * curPtr
Definition ixmlparser.h:79
char * dataBuffer
Definition ixmlparser.h:77
char * savePtr
Definition ixmlparser.h:81
The ixml_membuf type.
Definition ixmlmembuf.h:53