![]() |
GDBMS 1.0
|
#include "xmlParser.h"#include <memory.h>#include <assert.h>#include <stdio.h>#include <string.h>#include <stdlib.h>Go to the source code of this file.
Classes | |
| struct | ALLXMLClearTag |
| struct | XMLCharacterEntity |
| struct | XML |
| struct | NextToken |
Defines | |
| #define | _CRT_SECURE_NO_DEPRECATE |
| #define | INDENTCHAR _CXML('\t') |
| #define | XML_isSPACECHAR(ch) ((ch==_CXML('\n'))||(ch==_CXML(' '))||(ch== _CXML('\t'))||(ch==_CXML('\r'))) |
| #define | MEMORYINCREASE 50 |
| #define | LENSTR(lpsz) (lpsz ? xstrlen(lpsz) : 0) |
| #define | BASE64DECODE_READ_NEXT_CHAR(c) |
Typedefs | |
| typedef enum XMLTokenTypeTag | XMLTokenType |
| typedef struct XML | XML |
| typedef enum Attrib | Attrib |
| typedef enum XMLStatus | XMLStatus |
Enumerations | |
| enum | XMLTokenTypeTag { eTokenText = 0, eTokenQuotedText, eTokenTagStart, eTokenTagEnd, eTokenCloseTag, eTokenEquals, eTokenDeclaration, eTokenShortHandClose, eTokenClear, eTokenError } |
| enum | Attrib { eAttribName = 0, eAttribEquals, eAttribValue } |
| enum | XMLStatus { eInsideTag = 0, eOutsideTag } |
Functions | |
| void | freeXMLString (XMLSTR t) |
| to free the string allocated inside the "stringDup" function or the "createXMLString" function. | |
| int | mmin (const int t1, const int t2) |
| char | myIsTextWideChar (const void *b, int len) |
| char * | myWideCharToMultiByte (const wchar_t *s) |
| char | xmltob (XMLCSTR t, char v) |
| int | xmltoi (XMLCSTR t, int v) |
| long | xmltol (XMLCSTR t, long v) |
| double | xmltof (XMLCSTR t, double v) |
| XMLCSTR | xmltoa (XMLCSTR t, XMLCSTR v) |
| XMLCHAR | xmltoc (XMLCSTR t, const XMLCHAR v) |
| XMLSTR | stringDup (XMLCSTR lpszData, int cbData) |
| Duplicate (copy in a new allocated buffer) the source string. | |
| XMLSTR | fromXMLString (XMLCSTR s, int lo, XML *pXML) |
| char | myTagCompare (XMLCSTR cclose, XMLCSTR copen) |
Variables | |
| static char | dropWhiteSpace = 1 |
| static char | removeCommentsInMiddleOfText = 1 |
| XMLCSTR | base64EncodeTable = _CXML("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/") |
| const unsigned char | base64DecodeTable [] |
| #define _CRT_SECURE_NO_DEPRECATE |
XML.c - implementation file for basic XML parser written in ANSI C++ for portability. It works by using recursion and a node tree for breaking down the elements of an XML document.
NOTE:
If you add "#define STRICT_PARSING", on the first line of this file the parser will see the following XML-stream: some textother text as an error. Otherwise, this tring will be equivalent to: some textother text
NOTE:
If you add "#define APPROXIMATE_PARSING" on the first line of this file the parser will see the following XML-stream: <data name="n1"> <data name="n2"> <data name="n3"> as equivalent to the following XML-stream: <data name="n1"> <data name="n2"> <data name="n3"> This can be useful for badly-formed XML-streams but prevent the use of the following XML-stream (problem is: tags at contiguous levels have the same names): <data name="n1"> <data name="n2"> <data name="n3"> </data> </data>
NOTE:
If you add "#define _XMLPARSER_NO_MESSAGEBOX_" on the first line of this file the "openFileHelper" function will always display error messages inside the console instead of inside a message-box-window. Message-box-windows are available on windows 9x/NT/2000/XP/Vista only.
Copyright (c) 2002, Business-Insight Business-Insight All rights reserved. See the file "AFPL-license.txt" about the licensing terms
Definition at line 53 of file xmlParser.cpp.
| #define BASE64DECODE_READ_NEXT_CHAR | ( | c | ) |
do { c=base64DecodeTable[(unsigned char)data[i++]]; }while (c==97); \ if(c==98){ if(xe)*xe=eXMLErrorBase64DecodeIllegalCharacter; return 0; }
| #define INDENTCHAR _CXML('\t') |
Definition at line 116 of file xmlParser.cpp.
| #define LENSTR | ( | lpsz | ) | (lpsz ? xstrlen(lpsz) : 0) |
| #define MEMORYINCREASE 50 |
Definition at line 1107 of file xmlParser.cpp.
| #define XML_isSPACECHAR | ( | ch | ) | ((ch==_CXML('\n'))||(ch==_CXML(' '))||(ch== _CXML('\t'))||(ch==_CXML('\r'))) |
Definition at line 870 of file xmlParser.cpp.
| typedef enum XMLTokenTypeTag XMLTokenType |
| enum Attrib |
Definition at line 580 of file xmlParser.cpp.
| enum XMLStatus |
Definition at line 589 of file xmlParser.cpp.
| enum XMLTokenTypeTag |
| eTokenText | |
| eTokenQuotedText | |
| eTokenTagStart | |
| eTokenTagEnd | |
| eTokenCloseTag | |
| eTokenEquals | |
| eTokenDeclaration | |
| eTokenShortHandClose | |
| eTokenClear | |
| eTokenError |
Definition at line 545 of file xmlParser.cpp.
| XMLSTR fromXMLString | ( | XMLCSTR | s, |
| int | lo, | ||
| XML * | pXML | ||
| ) |
Definition at line 754 of file xmlParser.cpp.
| int mmin | ( | const int | t1, |
| const int | t2 | ||
| ) | [inline] |
Definition at line 78 of file xmlParser.cpp.
| char myIsTextWideChar | ( | const void * | b, |
| int | len | ||
| ) |
Definition at line 163 of file xmlParser.cpp.
| char myTagCompare | ( | XMLCSTR | cclose, |
| XMLCSTR | copen | ||
| ) |
Definition at line 873 of file xmlParser.cpp.
| char* myWideCharToMultiByte | ( | const wchar_t * | s | ) |
Definition at line 266 of file xmlParser.cpp.
| const unsigned char base64DecodeTable[] |
{
99,98,98,98,98,98,98,98,98,97, 97,98,98,97,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98,
98,98,97,98,98,98,98,98,98,98, 98,98,98,62,98,98,98,63,52,53, 54,55,56,57,58,59,60,61,98,98,
98,96,98,98,98, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, 15,16,17,18,19,20,21,22,23,24,
25,98,98,98,98,98,98,26,27,28, 29,30,31,32,33,34,35,36,37,38, 39,40,41,42,43,44,45,46,47,48,
49,50,51,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98,
98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98,
98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98,
98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98,
98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98
}
Definition at line 2777 of file xmlParser.cpp.
| XMLCSTR base64EncodeTable = _CXML("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/") |
Definition at line 2773 of file xmlParser.cpp.
| char dropWhiteSpace = 1 |
Definition at line 76 of file xmlParser.cpp.
| char removeCommentsInMiddleOfText = 1 |
Definition at line 76 of file xmlParser.cpp.
1.7.4