libUPnP
1.6.17
|
#include "ixmlparser.h"
#include "ixmldebug.h"
#include <assert.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Data Structures | |
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 void | Parser_freeElementStackItem (IXML_ElementStack *pItem) |
Frees one ElementStack item. | |
static void | Parser_freeNsURI (IXML_NamespaceURI *pNsURI) |
Frees namespaceURI item. | |
static void | Parser_free (Parser *xmlParser) |
Frees all temporary memory allocated by xmlparser. | |
static int | Parser_skipDocType (char **pstr) |
Skips document type declaration. | |
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_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_skipMisc (Parser *xmlParser) |
Skip comment, PI and white space. | |
static int | Parser_skipProlog (Parser *xmlParser) |
Skip prolog. | |
static int | Parser_setLastElem (Parser *xmlParser, const char *s) |
Set the last element to be the given string. | |
static void | Parser_clearTokenBuf (Parser *xmlParser) |
Clear token buffer. | |
static int | Parser_UTF8ToInt (const char *ss, ptrdiff_t *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 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 BOOL | Parser_isXmlChar (int c) |
see XML 1.0 (2nd Edition) 2.2. | |
static int | Parser_getChar (const char *src, ptrdiff_t *cLen) |
Returns next char value and its length. | |
static int | Parser_appendTokBufChar (Parser *xmlParser, char c) |
Appends c to token buffer. | |
static int | Parser_intToUTF8 (int c, utf8char s) |
Encodes a character to its UTF-8 character string, and return its length. | |
static int | Parser_appendTokBufStr (Parser *xmlParser, const char *s) |
Appends string s to token buffer. | |
static int | Parser_copyToken (Parser *xmlParser, const char *src, ptrdiff_t len) |
Copy string in src into xml parser token buffer. | |
static ptrdiff_t | Parser_getNextToken (Parser *xmlParser) |
Return the length of next token in tokenBuff. | |
static char * | safe_strdup (const char *s) |
Version of strdup() that handles NULL input. | |
static int | Parser_processSTag (Parser *xmlParser, IXML_Node *node) |
Processes the STag as defined by XML spec. | |
static int | Parser_skipPI (char **pSrc) |
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_processETag (Parser *xmlParser, IXML_Node *node, BOOL *bETag) |
Process ETag as defined by XML spec. | |
static char * | Parser_getNameSpace (Parser *xmlParser, const char *prefix) |
Unimplemented function. | |
static int | Parser_addNamespace (Parser *xmlParser) |
Add a namespace definition. | |
static int | Parser_xmlNamespace (Parser *xmlParser, IXML_Node *newNode) |
Add namespace definition. | |
static int | Parser_processAttribute (Parser *xmlParser, IXML_Node *node) |
Processes attribute. | |
static int | Parser_getNextNode (Parser *xmlParser, IXML_Node *node, BOOL *bETag) |
Get the next node. | |
static BOOL | Parser_ElementPrefixDefined (Parser *xmlParser, IXML_Node *newNode, char **nsURI) |
Decides whether element's prefix is already defined. | |
static int | Parser_setElementNamespace (IXML_Element *newElement, const char *nsURI) |
Set element's namespace. | |
static int | isDuplicateAttribute (Parser *xmlParser, IXML_Node *newAttrNode) |
Reports whether the new attribute is the same as an existing one. | |
static int | Parser_processAttributeName (IXML_Document *rootDoc, Parser *xmlParser, IXML_Node *newNode) |
Processes the attribute name. | |
static int | Parser_pushElement (Parser *xmlParser, IXML_Node *newElement) |
Push a new element onto element stack. | |
static int | isTopLevelElement (Parser *xmlParser) |
Reports whether there is a top level element in the parser. | |
static BOOL | Parser_hasDefaultNamespace (Parser *xmlParser, char **nsURI) |
Decide whether the current element has default namespace. | |
static int | Parser_processElementName (IXML_Document *rootDoc, Parser *xmlParser, IXML_Node *newNode) |
Processes element name. | |
static int | Parser_isValidEndElement (Parser *xmlParser, IXML_Node *newNode) |
Check if a new node->nodeName matches top of element stack. | |
static void | Parser_popElement (Parser *xmlParser) |
Remove element from element stack. | |
static int | Parser_eTagVerification (Parser *xmlParser, IXML_Node *newNode) |
Verifies endof element tag is the same as the openning element tag. | |
static int | Parser_parseDocument (IXML_Document **retDoc, Parser *xmlParser) |
Parses the xml file and returns the DOM document tree. | |
BOOL | Parser_isValidXmlName (const DOMString name) |
Check to see whether name is a valid xml name. | |
void | Parser_setErrorChar (char c) |
Sets the error character. | |
static Parser * | Parser_init () |
Initializes a xml parser. | |
static int | Parser_readFileOrBuffer (Parser *xmlParser, const char *xmlFileName, BOOL file) |
Read a xml file or buffer contents into xml parser. | |
int | Parser_LoadDocument (IXML_Document **retDoc, const char *xmlFileName, BOOL file) |
Parses a xml file and return the DOM tree. | |
void | Parser_freeNodeContent (IXML_Node *nodeptr) |
Fees a node contents. | |
int | Parser_setNodePrefixAndLocalName (IXML_Node *node) |
Set the node prefix and localName as defined by the nodeName in the form of ns:name. | |
Variables | |
static char | g_error_char = '\0' |
static const char | LESSTHAN = '<' |
static const char | GREATERTHAN = '>' |
static const char | SLASH = '/' |
static const char | EQUALS = '=' |
static const char | QUOTE = '\"' |
static const char | SINGLEQUOTE = '\'' |
static const char * | WHITESPACE = "\n\t\r " |
static const char * | COMPLETETAG = "/>" |
static const char * | ENDTAG = "</" |
static const char * | XMLDECL = "<?xml " |
static const char * | XMLDECL2 = "<?xml?" |
static const char * | BEGIN_COMMENT = "<!--" |
static const char * | END_COMMENT = "-->" |
static const char * | BEGIN_PI = "<?" |
static const char * | END_PI = "?>" |
static const char * | BEGIN_DOCTYPE = "<!DOCTYPE" |
static const char * | CDSTART = "<![CDATA[" |
static const char * | CDEND = "]]>" |
static const char * | DEC_NUMBERS = "0123456789" |
static const char * | HEX_NUMBERS = "0123456789ABCDEFabcdef" |
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 '_', ':'. |
#define LETTERTABLESIZE (sizeof(Letter)/sizeof(Letter[0])) |
The size of the letter table array.
Referenced by Parser_isNameChar().
#define NAMECHARTABLESIZE (sizeof(NameChar)/sizeof(NameChar[0])) |
The name char table array size.
Referenced by Parser_isNameChar().
static int isDuplicateAttribute | ( | Parser * | xmlParser, |
IXML_Node * | newAttrNode | ||
) | [static] |
Reports whether the new attribute is the same as an existing one.
[in] | xmlParser | The XML parser. |
[in] | newAttrNode | The node attribute to compare. |
References FALSE.
Referenced by Parser_processAttributeName().
static int isTopLevelElement | ( | Parser * | xmlParser | ) | [static] |
Reports whether there is a top level element in the parser.
[in] | xmlParser | The XML parser. |
Referenced by Parser_processElementName().
static int Parser_addNamespace | ( | Parser * | xmlParser | ) | [static] |
Add a namespace definition.
[in] | xmlParser | The XML parser. |
References Parser_getNameSpace(), and safe_strdup().
Referenced by Parser_xmlNamespace().
static int Parser_appendTokBufChar | ( | Parser * | xmlParser, |
char | c | ||
) | [static] |
Appends c to token buffer.
[in] | xmlParser | The XML parser. |
[in] | c | The character to append. |
References ixml_membuf_append().
Referenced by Parser_copyToken().
static int Parser_appendTokBufStr | ( | Parser * | xmlParser, |
const char * | s | ||
) | [static] |
Appends string s to token buffer.
[in] | xmlParser | The XML parser. |
[in] | s | The string to append. |
References ixml_membuf_append_str().
Referenced by Parser_copyToken().
static void Parser_clearTokenBuf | ( | Parser * | xmlParser | ) | [static] |
Clear token buffer.
[in] | xmlParser | The XML parser. |
References ixml_membuf_destroy().
Referenced by Parser_getNextToken(), Parser_processAttribute(), and Parser_processContent().
static int Parser_copyToken | ( | Parser * | xmlParser, |
const char * | src, | ||
ptrdiff_t | len | ||
) | [static] |
Copy string in src into xml parser token buffer.
[in] | xmlParser | The XML parser. |
[in] | src | The string to copy from. |
[in] | len | The lenght to copy. |
References IxmlPrintf(), Parser_appendTokBufChar(), Parser_appendTokBufStr(), Parser_getChar(), and Parser_intToUTF8().
Referenced by Parser_getNextToken(), Parser_processAttribute(), and Parser_processContent().
static BOOL Parser_ElementPrefixDefined | ( | Parser * | xmlParser, |
IXML_Node * | newNode, | ||
char ** | nsURI | ||
) | [static] |
Decides whether element's prefix is already defined.
[in] | xmlParser | The XML parser. |
[in] | newNode | The Node to process. |
[in,out] | nsURI | The name space URI. |
References FALSE.
Referenced by Parser_processElementName().
static int Parser_eTagVerification | ( | Parser * | xmlParser, |
IXML_Node * | newNode | ||
) | [static] |
Verifies endof element tag is the same as the openning element tag.
[in] | xmlParser | The XML parser. |
[in] | newNode | The Node to process. |
References Parser_isValidEndElement(), and Parser_popElement().
Referenced by Parser_parseDocument().
static void Parser_free | ( | Parser * | xmlParser | ) | [static] |
Frees all temporary memory allocated by xmlparser.
[in] | xmlParser | The XML parser. |
References _Parser::dataBuffer, ixml_membuf_destroy(), Parser_freeElementStackItem(), and Parser_freeNsURI().
Referenced by Parser_LoadDocument(), and Parser_parseDocument().
static void Parser_freeElementStackItem | ( | IXML_ElementStack * | pItem | ) | [static] |
Frees one ElementStack item.
[in] | pItem | The element stack item to free. |
Referenced by Parser_free(), Parser_popElement(), and Parser_pushElement().
void Parser_freeNodeContent | ( | IXML_Node * | nodeptr | ) |
Fees a node contents.
[in] | nodeptr | The Node to process. |
Referenced by Parser_parseDocument().
static void Parser_freeNsURI | ( | IXML_NamespaceURI * | pNsURI | ) | [static] |
Frees namespaceURI item.
[in] | pNsURI | The name space URI item to free. |
Referenced by Parser_free(), Parser_popElement(), and Parser_xmlNamespace().
static int Parser_getChar | ( | const char * | src, |
ptrdiff_t * | cLen | ||
) | [static] |
Returns next char value and its length.
[in] | src | . |
[in,out] | cLen | . |
References IxmlPrintf(), Parser_isXmlChar(), and Parser_UTF8ToInt().
Referenced by Parser_copyToken().
static char* Parser_getNameSpace | ( | Parser * | xmlParser, |
const char * | prefix | ||
) | [static] |
Unimplemented function.
Return the namespce as defined as prefix.
[in] | xmlParser | The XML parser. |
[in] | prefix | The prefix. |
Referenced by Parser_addNamespace().
static int Parser_getNextNode | ( | Parser * | xmlParser, |
IXML_Node * | node, | ||
BOOL * | bETag | ||
) | [static] |
Get the next node.
[in] | xmlParser | The XML parser. |
[out] | node | The XML parser. |
[out] | bETag | The XML parser. |
References _Parser::curPtr, IxmlPrintf(), Parser_getNextToken(), Parser_processAttribute(), Parser_processContent(), Parser_processETag(), Parser_processSTag(), Parser_skipWhiteSpaces(), and safe_strdup().
Referenced by Parser_parseDocument().
static ptrdiff_t Parser_getNextToken | ( | Parser * | xmlParser | ) | [static] |
Return the length of next token in tokenBuff.
[in] | xmlParser | The XML parser. |
References _Parser::curPtr, FALSE, Parser_clearTokenBuf(), Parser_copyToken(), Parser_isNameChar(), Parser_skipMisc(), Parser_UTF8ToInt(), and _Parser::savePtr.
Referenced by Parser_getNextNode(), Parser_processAttribute(), Parser_processETag(), and Parser_processSTag().
static BOOL Parser_hasDefaultNamespace | ( | Parser * | xmlParser, |
char ** | nsURI | ||
) | [static] |
Decide whether the current element has default namespace.
[in] | xmlParser | The XML parser. |
[in,out] | nsURI | The name space URI. |
References FALSE.
Referenced by Parser_processElementName().
static Parser* Parser_init | ( | ) | [static] |
Initializes a xml parser.
References ixml_membuf_init().
Referenced by Parser_LoadDocument().
static int Parser_intToUTF8 | ( | int | c, |
utf8char | s | ||
) | [static] |
Encodes a character to its UTF-8 character string, and return its length.
[in] | c | The character to encode. |
[out] | s | The resultant UTF-8 encoded string. |
Referenced by Parser_copyToken().
static BOOL Parser_isCharInTable | ( | int | c, |
char_info_t * | tbl, | ||
int | sz | ||
) | [static] |
Will determine whether character c is in the table of tbl (either Letter table or NameChar table).
[in] | c | Character to check. |
[in] | tbl | Table to use. |
[in] | sz | Size of the table. |
References FALSE.
Referenced by Parser_isNameChar().
static BOOL Parser_isNameChar | ( | int | c, |
BOOL | bNameChar | ||
) | [static] |
Check whether c (int) is in LetterTable or NameCharTable.
[in] | c | The character to check. |
[in] | bNameChar | TRUE if you also want to check in the NameChar table. |
References FALSE, LETTERTABLESIZE, NAMECHARTABLESIZE, and Parser_isCharInTable().
Referenced by Parser_getNextToken(), Parser_isValidXmlName(), and Parser_processAttribute().
static int Parser_isValidEndElement | ( | Parser * | xmlParser, |
IXML_Node * | newNode | ||
) | [static] |
Check if a new node->nodeName matches top of element stack.
[in] | xmlParser | The XML parser. |
[in] | newNode | The node. |
Referenced by Parser_eTagVerification().
BOOL Parser_isValidXmlName | ( | const DOMString | name | ) |
Check to see whether name is a valid xml name.
[in] | name | The string to be checked. |
References FALSE, and Parser_isNameChar().
static BOOL Parser_isXmlChar | ( | int | c | ) | [static] |
see XML 1.0 (2nd Edition) 2.2.
[in] | c | The character to check. |
Referenced by Parser_getChar(), and Parser_processCDSect().
int Parser_LoadDocument | ( | IXML_Document ** | retDoc, |
const char * | xmlFileName, | ||
BOOL | file | ||
) |
Parses a xml file and return the DOM tree.
[out] | retDoc | The output document tree. |
[in] | xmlFileName | The file name or the buffer to copy, according to the parameter "file". |
[in] | file | TRUE if you want to read from a file, false if xmlFileName is the buffer to copy to the parser. |
References _Parser::curPtr, _Parser::dataBuffer, Parser_free(), Parser_init(), Parser_parseDocument(), and Parser_readFileOrBuffer().
Referenced by ixmlLoadDocumentEx(), and ixmlParseBufferEx().
static int Parser_parseDocument | ( | IXML_Document ** | retDoc, |
Parser * | xmlParser | ||
) | [static] |
Parses the xml file and returns the DOM document tree.
[out] | retDoc | The XML document. |
[in] | xmlParser | The XML parser. |
References FALSE, ixmlDocument_createCDATASectionEx(), ixmlDocument_createDocumentEx(), ixmlDocument_createTextNodeEx(), ixmlDocument_free(), ixmlNode_appendChild(), ixmlNode_init(), Parser_eTagVerification(), Parser_free(), Parser_freeNodeContent(), Parser_getNextNode(), Parser_processAttributeName(), Parser_processElementName(), and Parser_skipProlog().
Referenced by Parser_LoadDocument().
static void Parser_popElement | ( | Parser * | xmlParser | ) | [static] |
Remove element from element stack.
[in] | xmlParser | The XML parser. |
References Parser_freeElementStackItem(), and Parser_freeNsURI().
Referenced by Parser_eTagVerification().
static int Parser_processAttribute | ( | Parser * | xmlParser, |
IXML_Node * | node | ||
) | [static] |
Processes attribute.
[in] | xmlParser | The XML parser. |
[in] | node | The Node to process. |
References _Parser::curPtr, FALSE, IxmlPrintf(), Parser_clearTokenBuf(), Parser_copyToken(), Parser_getNextToken(), Parser_isNameChar(), Parser_UTF8ToInt(), Parser_xmlNamespace(), safe_strdup(), and _Parser::savePtr.
Referenced by Parser_getNextNode().
static int Parser_processAttributeName | ( | IXML_Document * | rootDoc, |
Parser * | xmlParser, | ||
IXML_Node * | newNode | ||
) | [static] |
Processes the attribute name.
[in] | rootDoc | The XML document. |
[in] | xmlParser | The XML parser. |
[in] | newNode | The Node to process. |
References isDuplicateAttribute(), ixmlAttr_free(), ixmlDocument_createAttributeEx(), ixmlElement_setAttributeNode(), and ixmlNode_setNodeProperties().
Referenced by Parser_parseDocument().
static int Parser_processCDSect | ( | char ** | pSrc, |
IXML_Node * | node | ||
) | [static] |
Processes CDSection as defined by XML spec.
[in] | pSrc | . |
[in] | node | The Node to process. |
References Parser_isXmlChar(), and safe_strdup().
Referenced by Parser_processContent().
static int Parser_processContent | ( | Parser * | xmlParser, |
IXML_Node * | node | ||
) | [static] |
Processes the CONTENT as defined in XML spec.
[in] | xmlParser | The XML parser. |
[in] | node | The Node to process. |
References _Parser::curPtr, IxmlPrintf(), Parser_clearTokenBuf(), Parser_copyToken(), Parser_processCDSect(), Parser_skipComment(), Parser_skipPI(), Parser_skipWhiteSpaces(), safe_strdup(), and _Parser::savePtr.
Referenced by Parser_getNextNode().
static int Parser_processElementName | ( | IXML_Document * | rootDoc, |
Parser * | xmlParser, | ||
IXML_Node * | newNode | ||
) | [static] |
Processes element name.
[in] | rootDoc | The XML document. |
[in] | xmlParser | The XML parser. |
[in] | newNode | The Node to process. |
References _Parser::curPtr, isTopLevelElement(), ixmlDocument_createElementEx(), ixmlElement_free(), ixmlNode_appendChild(), ixmlNode_setNodeProperties(), Parser_ElementPrefixDefined(), Parser_hasDefaultNamespace(), Parser_pushElement(), Parser_setElementNamespace(), and _Parser::savePtr.
Referenced by Parser_parseDocument().
static int Parser_processETag | ( | Parser * | xmlParser, |
IXML_Node * | node, | ||
BOOL * | bETag | ||
) | [static] |
Process ETag as defined by XML spec.
[in] | xmlParser | The XML parser. |
[in] | node | The Node to process. |
[out] | bETag | . |
References IxmlPrintf(), Parser_getNextToken(), Parser_skipWhiteSpaces(), and safe_strdup().
Referenced by Parser_getNextNode().
static int Parser_processSTag | ( | Parser * | xmlParser, |
IXML_Node * | node | ||
) | [static] |
Processes the STag as defined by XML spec.
[in] | xmlParser | The XML parser. |
[in] | node | The Node to process. |
References _Parser::curPtr, Parser_getNextToken(), Parser_setLastElem(), Parser_setNodePrefixAndLocalName(), safe_strdup(), and _Parser::savePtr.
Referenced by Parser_getNextNode().
static int Parser_pushElement | ( | Parser * | xmlParser, |
IXML_Node * | newElement | ||
) | [static] |
Push a new element onto element stack.
[in] | xmlParser | The XML parser. |
[in] | newElement | The element node to push. |
References Parser_freeElementStackItem(), and safe_strdup().
Referenced by Parser_processElementName().
static int Parser_readFileOrBuffer | ( | Parser * | xmlParser, |
const char * | xmlFileName, | ||
BOOL | file | ||
) | [static] |
Read a xml file or buffer contents into xml parser.
[in] | xmlParser | The XML parser. |
[in] | xmlFileName | The file name or the buffer to copy, according to the parameter "file". |
[in] | file | TRUE if you want to read from a file, false if xmlFileName is the buffer to copy to the parser. |
References _Parser::dataBuffer, and safe_strdup().
Referenced by Parser_LoadDocument().
static int Parser_setElementNamespace | ( | IXML_Element * | newElement, |
const char * | nsURI | ||
) | [static] |
Set element's namespace.
[in] | newElement | The Element Node to process. |
[in] | nsURI | The name space string. |
References safe_strdup().
Referenced by Parser_processElementName().
void Parser_setErrorChar | ( | char | c | ) |
Sets the error character.
If 'c' is 0 (default), the parser is strict about XML encoding: invalid UTF-8 sequences or "&" entities are rejected, and the parsing aborts.
If 'c' is not 0, the parser is relaxed: invalid UTF-8 characters are replaced by this character, and invalid "&" entities are left untranslated. The parsing is then allowed to continue.
[in] | c | The character to become the error character. |
Referenced by ixmlRelaxParser().
static int Parser_setLastElem | ( | Parser * | xmlParser, |
const char * | s | ||
) | [static] |
Set the last element to be the given string.
[in] | xmlParser | The XML parser. |
[in] | s | The string to copy from. |
References ixml_membuf_assign_str().
Referenced by Parser_processSTag().
int Parser_setNodePrefixAndLocalName | ( | IXML_Node * | node | ) |
Set the node prefix and localName as defined by the nodeName in the form of ns:name.
[in,out] | node | The Node to process. |
References safe_strdup().
Referenced by ixmlNode_setNodeName(), Parser_processSTag(), and Parser_xmlNamespace().
static int Parser_skipComment | ( | char ** | pstrSrc | ) | [static] |
Skips all characters in the string until it finds the skip key. Then it skips the skip key and returns.
[in,out] | pstrSrc | The pointer to the skipped point. |
Referenced by Parser_processContent(), and Parser_skipMisc().
static int Parser_skipDocType | ( | char ** | pstr | ) | [static] |
Skips document type declaration.
[in,out] | pstr | The pointer to the skipped point. |
Referenced by Parser_skipProlog().
static int Parser_skipMisc | ( | Parser * | xmlParser | ) | [static] |
Skip comment, PI and white space.
[in] | xmlParser | The XML parser. |
References _Parser::curPtr, FALSE, Parser_skipComment(), Parser_skipString(), and Parser_skipWhiteSpaces().
Referenced by Parser_getNextToken(), and Parser_skipProlog().
static int Parser_skipPI | ( | char ** | pSrc | ) | [static] |
[in,out] | pSrc | The pointer to the skipped point. |
Referenced by Parser_processContent().
static int Parser_skipProlog | ( | Parser * | xmlParser | ) | [static] |
Skip prolog.
[in,out] | xmlParser | The XML parser. |
References _Parser::curPtr, Parser_skipDocType(), Parser_skipMisc(), Parser_skipWhiteSpaces(), and Parser_skipXMLDecl().
Referenced by Parser_parseDocument().
static int Parser_skipString | ( | char ** | pstrSrc, |
const char * | strSkipKey | ||
) | [static] |
Skips all characters in the string until it finds the skip key. Then it skips the skip key and returns.
[in,out] | pstrSrc | The pointer to the skipped point. |
[in] | strSkipKey | The skip key. |
Referenced by Parser_skipMisc(), and Parser_skipXMLDecl().
static void Parser_skipWhiteSpaces | ( | Parser * | xmlParser | ) | [static] |
Skip white spaces.
[in] | xmlParser | The XML parser. |
References _Parser::curPtr.
Referenced by Parser_getNextNode(), Parser_processContent(), Parser_processETag(), Parser_skipMisc(), Parser_skipProlog(), and Parser_skipXMLDecl().
static int Parser_skipXMLDecl | ( | Parser * | xmlParser | ) | [static] |
Skips XML declarations.
[in,out] | xmlParser | The XML parser. |
References _Parser::curPtr, Parser_skipString(), and Parser_skipWhiteSpaces().
Referenced by Parser_skipProlog().
static int Parser_UTF8ToInt | ( | const char * | ss, |
ptrdiff_t * | len | ||
) | [static] |
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.
[in] | ss | The pointer to the character to encode. |
[out] | len | The number of octets of the UTF-8 encoding of this character. |
References IxmlPrintf().
Referenced by Parser_getChar(), Parser_getNextToken(), and Parser_processAttribute().
static int Parser_xmlNamespace | ( | Parser * | xmlParser, |
IXML_Node * | newNode | ||
) | [static] |
Add namespace definition.
[in] | xmlParser | The XML parser. |
[in] | newNode | The Node to process. |
References IxmlPrintf(), Parser_addNamespace(), Parser_freeNsURI(), Parser_setNodePrefixAndLocalName(), and safe_strdup().
Referenced by Parser_processAttribute().
static char* safe_strdup | ( | const char * | s | ) | [static] |
Version of strdup() that handles NULL input.
[in] | s | String to be duplicated. |
Referenced by Parser_addNamespace(), Parser_getNextNode(), Parser_processAttribute(), Parser_processCDSect(), Parser_processContent(), Parser_processETag(), Parser_processSTag(), Parser_pushElement(), Parser_readFileOrBuffer(), Parser_setElementNamespace(), Parser_setNodePrefixAndLocalName(), and Parser_xmlNamespace().
char_info_t Letter[] [static] |
The letter table contains all characters in XML 1.0 plus ":", "_" and ideographic.
This table contains all the characters that an element name can start with. See XML 1.0 (2nd Edition) for more details.
char_info_t NameChar[] [static] |
The NameChar table contains CombiningChar, Extender, Digit, '-', '.', less '_', ':'.
NameChar ::= Digit | '-' | '.' | CombiningChar | Extender See XML 1.0 2nd Edition