replicode
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
xml_parser.cpp File Reference
#include "xml_parser.h"
#include <memory.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "types.h"
Include dependency graph for xml_parser.cpp:

Classes

struct  core::ALLXMLClearTag
 
struct  core::XMLCharacterEntity
 
struct  core::XML
 
struct  core::NextToken
 

Namespaces

 core
 

Macros

#define _CRT_SECURE_NO_DEPRECATE
 
#define INDENTCHAR   _X('\t')
 
#define XML_isSPACECHAR(ch)   ((ch==_X('\n'))||(ch==_X(' '))||(ch== _X('\t'))||(ch==_X('\r')))
 
#define MEMORYINCREASE   50
 
#define LENSTR(lpsz)   (lpsz ? xstrlen(lpsz) : 0)
 
#define BASE64DECODE_READ_NEXT_CHAR(c)
 

Typedefs

typedef enum core::XMLTokenTypeTag core::XMLTokenType
 
typedef struct core::XML core::XML
 
typedef enum core::Attrib core::Attrib
 
typedef enum core::Status core::Status
 

Enumerations

enum  core::XMLTokenTypeTag {
  core::eTokenText = 0, core::eTokenQuotedText, core::eTokenTagStart, core::eTokenTagEnd,
  core::eTokenCloseTag, core::eTokenEquals, core::eTokenDeclaration, core::eTokenShortHandClose,
  core::eTokenClear, core::eTokenError
}
 
enum  core::Attrib { core::eAttribName = 0, core::eAttribEquals, core::eAttribValue }
 
enum  core::Status { core::eInsideTag = 0, core::eOutsideTag }
 

Functions

void core::freeXMLString (XMLSTR t)
 
int core::mmin (const int t1, const int t2)
 
char core::myIsTextWideChar (const void *b, int len)
 
char * core::myWideCharToMultiByte (const wchar_t *s)
 
static FILE * core::xfopen (XMLCSTR filename, XMLCSTR mode)
 
static int core::xstrlen (XMLCSTR c)
 
static int core::xstrnicmp (XMLCSTR c1, XMLCSTR c2, int l)
 
static int core::xstrncmp (XMLCSTR c1, XMLCSTR c2, int l)
 
static int core::xstricmp (XMLCSTR c1, XMLCSTR c2)
 
static XMLSTR core::xstrstr (XMLCSTR c1, XMLCSTR c2)
 
static XMLSTR core::xstrcpy (XMLSTR c1, XMLCSTR c2)
 
static int core::_strnicmp (const char *c1, const char *c2, int l)
 
XMLSTR core::stringDup (XMLCSTR lpszData, int cbData)
 
XMLSTR core::toXMLStringUnSafe (XMLSTR dest, XMLCSTR source)
 
int core::lengthXMLString (XMLCSTR source)
 
XMLSTR core::fromXMLString (XMLCSTR s, int lo, XML *pXML)
 
char core::myTagCompare (XMLCSTR cclose, XMLCSTR copen)
 
static XMLCHAR core::getNextChar (XML *pXML)
 
static NextToken core::GetNextToken (XML *pXML, int *pcbToken, enum XMLTokenTypeTag *pType)
 
static void core::myFree (void *p)
 
static void * core::myRealloc (void *p, int newsize, int memInc, int sizeofElem)
 
static void core::CountLinesAndColumns (XMLCSTR lpXML, int nUpto, XMLResults *pResults)
 
static void core::charmemset (XMLSTR dest, XMLCHAR c, int l)
 

Variables

static XMLNode::XMLCharEncoding core::characterEncoding = XMLNode::encoding_UTF8
 
static char core::guessWideCharChars = 1
 
static char core::dropWhiteSpace = 1
 
static ALLXMLClearTag core::XMLClearTags []
 
static XMLCharacterEntity core::XMLEntities []
 
static const char core::XML_utf8ByteTable [256]
 
static const char core::XML_asciiByteTable [256]
 
static const char core::XML_sjisByteTable [256]
 
static const char * core::XML_ByteTable = (const char *)XML_utf8ByteTable
 
static const char core::base64Fillchar = _X('=')
 
XMLCSTR core::base64EncodeTable = _X("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
 
const unsigned char core::base64DecodeTable []
 

Macro Definition Documentation

#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.

Version
V2.31
Author
Frank Vanden Berghen

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.

BSD license: Copyright (c) 2002, Frank Vanden Berghen 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 the name of the Frank Vanden Berghen 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 REGENTS 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 THE REGENTS AND 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.

#define BASE64DECODE_READ_NEXT_CHAR (   c)
Value:
do { c=base64DecodeTable[(unsigned char)data[i++]]; }while (c==97); \
if(c==98){ if(xe)*xe=eXMLErrorBase64DecodeIllegalCharacter; return 0; }
const unsigned char base64DecodeTable[]
Definition: xml_parser.cpp:3694
#define INDENTCHAR   _X('\t')
#define LENSTR (   lpsz)    (lpsz ? xstrlen(lpsz) : 0)
#define MEMORYINCREASE   50
#define XML_isSPACECHAR (   ch)    ((ch==_X('\n'))||(ch==_X(' '))||(ch== _X('\t'))||(ch==_X('\r')))