ixmlparser.h
Go to the documentation of this file.
/**************************************************************************
*
* Copyright (c) 2000-2003 Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************/
#ifndef IXMLPARSER_H
#define IXMLPARSER_H
#include "ixml.h"
#include "ixmlmembuf.h"
/* Parser definitions */
#define QUOT "&quot;"
#define LT "&lt;"
#define GT "&gt;"
#define APOS "&apos;"
#define AMP "&amp;"
#define ESC_HEX "&#x"
#define ESC_DEC "&#"
typedef struct _IXML_NamespaceURI
{
char *nsURI;
char *prefix;
struct _IXML_NamespaceURI *nextNsURI;
} IXML_NamespaceURI;
typedef struct _IXML_ElementStack
{
char *element;
char *prefix;
char *namespaceUri;
IXML_NamespaceURI *pNsURI;
struct _IXML_ElementStack *nextElement;
} IXML_ElementStack;
typedef enum
{
eELEMENT,
eATTRIBUTE,
eCONTENT,
} PARSER_STATE;
typedef struct _Parser
{
char *dataBuffer;
char *curPtr;
char *savePtr;
ixml_membuf lastElem;
ixml_membuf tokenBuf;
IXML_Node *pNeedPrefixNode;
IXML_ElementStack *pCurElement;
IXML_Node *currentNodePtr;
PARSER_STATE state;
BOOL bHasTopLevel;
} Parser;
BOOL Parser_isValidXmlName(
const DOMString name);
void Parser_setErrorChar(
char c);
void Parser_freeNodeContent(
IXML_Node *IXML_Nodeptr);
int Parser_LoadDocument(IXML_Document **retDoc, const char * xmlFile, BOOL file);
int Parser_setNodePrefixAndLocalName(IXML_Node *newIXML_NodeIXML_Attr);
void ixmlAttr_init(IXML_Attr *attrNode);
int ixmlElement_setTagName(
IXML_Element *element,
const char *tagName);
void ixmlNamedNodeMap_init(
IXML_NamedNodeMap *nnMap);
int ixmlNamedNodeMap_addToNamedNodeMap(
/* [in] The named node map. */
IXML_NamedNodeMap **nnMap,
/* [in] The node to add. */
IXML_Node *add);
int ixmlNodeList_addToNodeList(
IXML_NodeList **nList,
IXML_Node *add);
void ixmlNode_init(
IN IXML_Node *nodeptr);
BOOL ixmlNode_compare(
IXML_Node *srcNode,
IXML_Node *destNode);
void ixmlNode_getElementsByTagName(
IXML_Node *n,
const char *tagname,
IXML_NodeList **list);
void ixmlNode_getElementsByTagNameNS(
IXML_Node *n,
const char *namespaceURI,
const char *localName,
IXML_NodeList **list);
int ixmlNode_setNodeName(
IXML_Node *node,
const DOMString qualifiedName);
int ixmlNode_setNodeProperties(
IXML_Node *destNode,
IXML_Node *src);
void ixmlNodeList_init(
IXML_NodeList *nList);
#endif /* IXMLPARSER_H */
_Parser::savePtr
char * savePtr
Definition: ixmlparser.h:89
ixmlNode_setNodeProperties
int ixmlNode_setNodeProperties(IXML_Node *destNode, IXML_Node *src)
Definition: node.c:1303
_Parser::dataBuffer
char * dataBuffer
Definition: ixmlparser.h:85
_IXML_NamespaceURI
Definition: ixmlparser.h:56
ixml.h
ixmlmembuf.h
ixmlNode_init
void ixmlNode_init(IN IXML_Node *nodeptr)
Intializes a node.
Parser_LoadDocument
int Parser_LoadDocument(IXML_Document **retDoc, const char *xmlFile, BOOL file)
Parses a xml file and return the DOM tree.
Definition: ixmlparser.c:740
ixmlNode_getElementsByTagName
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:1189
ixmlNode_compare
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:455
ixmlNamedNodeMap_init
void ixmlNamedNodeMap_init(IXML_NamedNodeMap *nnMap)
Initializes a NamedNodeMap object.
Definition: namedNodeMap.c:76
Parser_freeNodeContent
void Parser_freeNodeContent(IXML_Node *IXML_Nodeptr)
Fees a node contents.
Definition: ixmlparser.c:949
_Parser
Definition: ixmlparser.h:82
ixmlElement_setTagName
int ixmlElement_setTagName(IXML_Element *element, const char *tagName)
Set the given element's tagName.
Definition: element.c:63
ixmlNode_setNodeName
int ixmlNode_setNodeName(IXML_Node *node, const DOMString qualifiedName)
Definition: node.c:1273
ixmlNodeList_addToNodeList
int ixmlNodeList_addToNodeList(IXML_NodeList **nList, IXML_Node *add)
Add a node to nodelist.
Definition: nodeList.c:81
ixmlNode_getElementsByTagNameNS
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:1245
_Parser::curPtr
char * curPtr
Definition: ixmlparser.h:87
ixmlNamedNodeMap_addToNamedNodeMap
int ixmlNamedNodeMap_addToNamedNodeMap(IXML_NamedNodeMap **nnMap, IXML_Node *add)
Add a node to a NamedNodeMap.
Definition: namedNodeMap.c:155
ixml_membuf
The ixml_membuf type.
Definition: ixmlmembuf.h:58
_IXML_Node
Data structure common to all types of nodes.
Definition: ixml.h:161
Parser_isValidXmlName
BOOL Parser_isValidXmlName(const DOMString name)
Check to see whether name is a valid xml name.
Definition: ixmlparser.c:376
_IXML_ATTR
Data structure representing an Attribute node.
Definition: ixml.h:211
_IXML_NodeList
Data structure representing a list of nodes.
Definition: ixml.h:231
DOMString
#define DOMString
The type of DOM strings.
Definition: ixml.h:55
_IXML_ElementStack
Definition: ixmlparser.h:64
ixmlNodeList_init
void ixmlNodeList_init(IXML_NodeList *nList)
Initializes a nodelist.
Definition: nodeList.c:45
_IXML_Document
Data structure representing the DOM Document.
Definition: ixml.h:183
_IXML_Element
Data structure representing an Element node.
Definition: ixml.h:201
Parser_setNodePrefixAndLocalName
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:1755
_IXML_NamedNodeMap
Data structure representing a list of named nodes.
Definition: ixml.h:241
Parser_setErrorChar
void Parser_setErrorChar(char c)
Sets the error character.
Definition: ixmlparser.c:399