Logo Search packages:      
Sourcecode: libupnp4 version File versions  Download package

ixmlparser.c File Reference


Detailed Description

Definition in file ixmlparser.c.

#include "ixmlparser.h"
#include "ixmldebug.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Classes

struct  char_info

Defines

#define LETTERTABLESIZE   (sizeof(Letter)/sizeof(Letter[0]))
 The size of the letter table array.
#define NAMECHARTABLESIZE   (sizeof(NameChar)/sizeof(NameChar[0]))
 The name char table array size.

Typedefs

typedef struct char_info char_info_t
typedef char utf8char [8]

Functions

static int isDuplicateAttribute (Parser *xmlParser, IXML_Node *newAttrNode)
 Reports whether the new attribute is the same as an existing one.
static int isTopLevelElement (Parser *xmlParser)
 Reports whether there is a top level element in the parser.
static int Parser_addNamespace (Parser *xmlParser)
 Add a namespace definition.
static int Parser_appendTokBufChar (Parser *xmlParser, char c)
 Appends c to token buffer.
static int Parser_appendTokBufStr (Parser *xmlParser, const char *s)
 Appends string s to token buffer.
static void Parser_clearTokenBuf (Parser *xmlParser)
 Clear token buffer.
static int Parser_copyToken (Parser *xmlParser, const char *src, int len)
 Copy string in src into xml parser token buffer.
static BOOL Parser_ElementPrefixDefined (Parser *xmlParser,IXML_Node *newNode,char **nsURI)
 Decides whether element's prefix is already defined.
static int Parser_eTagVerification (Parser *xmlParser, IXML_Node *newNode)
 Verifies endof element tag is the same as the openning element tag.
static void Parser_free (Parser *xmlParser)
 Frees all temporary memory allocated by xmlparser.
static void Parser_freeElementStackItem (IXML_ElementStack *pItem)
 Frees one ElementStack item.
void Parser_freeNodeContent (IXML_Node *nodeptr)
 Fees a node contents.
static void Parser_freeNsURI (IXML_NamespaceURI *pNsURI)
 Frees namespaceURI item.
static int Parser_getChar (const char *src,int *cLen)
 Returns next char value and its length.
static char * Parser_getNameSpace (Parser *xmlParser, const char *prefix)
 Return the namespce as defined as prefix.
static int Parser_getNextNode (Parser *xmlParser,IXML_Node *node,BOOL *bETag)
 Get the next node.
static int Parser_getNextToken (Parser *xmlParser)
 Return the length of next token in tokenBuff.
static BOOL Parser_hasDefaultNamespace (Parser *xmlParser,IXML_Node *newNode,char **nsURI)
 Decide whether the current element has default namespace.
static Parser * Parser_init ()
 Initializes a xml parser.
static int Parser_intToUTF8 (int c, utf8char s)
 Encodes a character to its UTF-8 character string, and return its length.
static BOOL Parser_isCharInTable (int c, char_info_t *tbl, int sz)
 Will determine whether character c is in the table of tbl (either Letter table or NameChar table).
static BOOL Parser_isNameChar (int c, BOOL bNameChar)
 Check whether c (int) is in LetterTable or NameCharTable.
static int Parser_isValidEndElement (Parser *xmlParser, IXML_Node *newNode)
 Check if a new node->nodeName matches top of element stack.
BOOL Parser_isValidXmlName (const DOMString name)
 Check to see whether name is a valid xml name.
static BOOL Parser_isXmlChar (int c)
 see XML 1.0 (2nd Edition) 2.2.
int Parser_LoadDocument (IXML_Document **retDoc, const char *xmlFileName, BOOL file)
 Parses a xml file and return the DOM tree.
static int Parser_parseDocument (IXML_Document **retDoc,Parser *xmlParser)
 Parses the xml file and returns the DOM document tree.
static int Parser_parseReference (char *pStr)
 Unimplemented function.
static void Parser_popElement (Parser *xmlParser)
 Remove element from element stack.
static int Parser_processAttribute (Parser *xmlParser, IXML_Node *node)
 Processes attribute.
static int Parser_processAttributeName (IXML_Document *rootDoc, Parser *xmlParser, IXML_Node *newNode)
 Processes the attribute name.
static int Parser_processCDSect (char **pSrc, IXML_Node *node)
 Processes CDSection as defined by XML spec.
static int Parser_processContent (Parser *xmlParser, IXML_Node *node)
 Processes the CONTENT as defined in XML spec.
static int Parser_processElementName (IXML_Document *rootDoc, Parser *xmlParser, IXML_Node *newNode)
 Processes element name.
static int Parser_processETag (Parser *xmlParser, IXML_Node *node, BOOL *bETag)
 Process ETag as defined by XML spec.
static int Parser_processSTag (Parser *xmlParser, IXML_Node *node)
 Processes the STag as defined by XML spec.
static int Parser_pushElement (Parser *xmlParser, IXML_Node *newElement)
 Push a new element onto element stack.
static int Parser_readFileOrBuffer (Parser *xmlParser, const char *xmlFileName, BOOL file)
 Read a xml file or buffer contents into xml parser.
static int Parser_setElementNamespace (IXML_Element *newElement,const char *nsURI)
 Set element's namespace.
void Parser_setErrorChar (char c)
 Sets the error character.
static int Parser_setLastElem (Parser *xmlParser, const char *s)
 Set the last element to be the given string.
int Parser_setNodePrefixAndLocalName (IXML_Node *node)
 Set the node prefix and localName as defined by the nodeName in the form of ns:name.
static int Parser_skipComment (char **pstrSrc)
 Skips all characters in the string until it finds the skip key. Then it skips the skip key and returns.
static int Parser_skipDocType (char **pstr)
 Skips document type declaration.
static int Parser_skipMisc (Parser *xmlParser)
 Skip comment, PI and white space.
static int Parser_skipPI (char **pSrc)
static int Parser_skipProlog (Parser *xmlParser)
 Skip prolog.
static int Parser_skipString (char **pstrSrc, const char *strSkipKey)
 Skips all characters in the string until it finds the skip key. Then it skips the skip key and returns.
static void Parser_skipWhiteSpaces (Parser *xmlParser)
 Skip white spaces.
static int Parser_skipXMLDecl (Parser *xmlParser)
 Skips XML declarations.
static int Parser_UTF8ToInt (const char *ss, int *len)
 In UTF-8, characters are encoded using sequences of 1 to 6 octets. This functions will return a UTF-8 character value and its octets number.
static int Parser_xmlNamespace (Parser *xmlParser,IXML_Node *newNode)
 Add namespace definition.
static char * safe_strdup (const char *s)
 Version of strdup() that handles NULL input.

Variables

static const char * BEGIN_COMMENT = "<!--"
static const char * BEGIN_DOCTYPE = "<!DOCTYPE"
static const char * BEGIN_PI = "<?"
static const char * CDEND = "]]>"
static const char * CDSTART = "<![CDATA["
static const char * COMPLETETAG = "/>"
static const char * DEC_NUMBERS = "0123456789"
static const char * END_COMMENT = "-->"
static const char * END_PI = "?>"
static const char * ENDTAG = "</"
static const char EQUALS = '='
static char g_error_char = '\0'
static const char GREATERTHAN = '>'
static const char * HEX_NUMBERS = "0123456789ABCDEFabcdef"
static const char LESSTHAN = '<'
static char_info_t Letter []
 The letter table contains all characters in XML 1.0 plus ":", "_" and ideographic.
static char_info_t NameChar []
 The NameChar table contains CombiningChar, Extender, Digit, '-', '.', less '_', ':'.
static const char QUOTE = '\"'
static const char SINGLEQUOTE = '\''
static const char SLASH = '/'
static const char * WHITESPACE = "\n\t\r "
static const char * XMLDECL = "<?xml "
static const char * XMLDECL2 = "<?xml?"


Generated by  Doxygen 1.6.0   Back to index