IncredibleXMLParser  3.05
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | List of all members

Class Defining the Incredible XML Pull Parser. More...

#include <IXMLParser.h>

Inheritance diagram for IXMLPullParser:
IPullParser

Public Member Functions

 IXMLPullParser (IXMLReader *uReader, int _szByteBuffer=1024 *1024)
 
 ~IXMLPullParser ()
 
void reset ()
 re-start the pull parser (set token=IXMLToken_StartDocument) More...
 
void clear ()
 
IXMLToken nextToken ()
 read the data stream a little bit more to get the next token More...
 
int getColumnNumber () const
 return the current column number expressed in byte or wchar More...
 
- Public Member Functions inherited from IPullParser
 IPullParser (IXMLReader *_uReader, int _szByteBuffer)
 
virtual ~IPullParser ()
 
char setBufferSize (int _szByteBuffer)
 Change the memory buffer size. More...
 
IXMLToken currentToken () const
 get the current token More...
 
bool findPath (IXMLCStr path, IXMLChar sep='/', IXMLResults *r=NULL)
 read the data stream to reach a XML tag with the specified path More...
 
bool findPathNonConst (IXMLStr path, IXMLChar sep='/', IXMLResults *r=NULL)
 read the data stream to reach a XML tag with the specified path More...
 
IXMLCStr getName () const
 if the current token==IXMLToken_StartTag, return the tag name More...
 
bool isEmptyNode () const
 if the current token==IXMLToken_StartTag, tell if the tag is directly closed or not More...
 
bool isArrayStart () const
 used during JSON parsing to separate arrays([) from object({). More...
 
int nAttribute () const
 if the current token==IXMLToken_StartTag, return number of attributes More...
 
IXMLAttributegetAttribute (int i=0) const
 if the current token==IXMLToken_StartTag, return ith attribute More...
 
IXMLCStr getAttributeName (int i=0) const
 if the current token==IXMLToken_StartTag, return ith attribute name More...
 
IXMLCStr getAttributeValue (int i=0) const
 if the current token==IXMLToken_StartTag, return ith attribute value More...
 
int szAttributeValue (int i=0) const
 if the current token==IXMLToken_StartTag, return ith attribute size More...
 
IXMLCStr getText () const
 if the current token==IXMLToken_Text, return the text More...
 
int szText () const
 if the current token==IXMLToken_Text, return the text size in char More...
 
bool isTextWhiteSpace () const
 if the current token==IXMLToken_Text, return true if the text is ignorable (i.e.composed of white space only) More...
 
const IXMLCleargetClear () const
 if the current token==IXMLToken_Clear, return the clear tag More...
 
IXMLError getErrorCode () const
 if the current token==IXMLToken_Error, return the error code More...
 
long long getLineNumber () const
 return the current line number More...
 
int getDepth () const
 return the current depth More...
 
void setAutoDetectSourceEncoding (bool autoDetectSource=false)
 
bool getAutoDetectSourceEncoding ()
 
virtual char setCharEncoding (IXMLCharEncoding sourceEncoding=char_encoding_UTF8, IXMLCharEncoding destinationEncoding=char_encoding_UTF8)
 
virtual IXMLCharEncoding getCharEncodingDestination ()
 
IXMLCStr getVersion ()
 Return the IXMLParser library version number. More...
 

Static Public Member Functions

static IXMLCStr guessXMLCharEncoding (unsigned char *b, int l, IXMLChar out[200])
 guess the Char Encoding of the text inside the buffer More...
 
static IXMLCharEncoding guessXMLCharEncodingCode (unsigned char *b, int l)
 guess the Char Encoding Code of the text inside the buffer More...
 
- Static Public Member Functions inherited from IPullParser
static IXMLCStr getErrorMessage (IXMLError error)
 this gives you a user-friendly explanation of the parsing error More...
 

Additional Inherited Members

- Public Types inherited from IPullParser
enum  IXMLToken {
  IXMLToken_StartDocument =0, IXMLToken_StartTag =1, IXMLToken_EndTag =2, IXMLToken_Text =3,
  IXMLToken_Clear =4, IXMLToken_ProcessingInstruction =5, IXMLToken_EndDocument =6, IXMLToken_Warning =7,
  IXMLToken_Error =8
}
 
enum  IXMLCharEncoding {
  char_encoding_error =0, char_encoding_UTF16 =1, char_encoding_UTF8 =2, char_encoding_System =3,
  char_encoding_legacy =4, char_encoding_ShiftJIS =5, char_encoding_GB2312 =6, char_encoding_Big5 =7,
  char_encoding_GBK =8
}
 Enumeration for XML character encoding. More...
 
typedef enum IPullParser::IXMLToken IXMLToken
 
typedef enum
IPullParser::IXMLCharEncoding 
IXMLCharEncoding
 Enumeration for XML character encoding. More...
 
- Protected Member Functions inherited from IPullParser
bool skipBranch (int skipVar)
 
char readData (IXMLStr *ptr, IXMLStr *pend, IXMLStr *ptrOut, IXMLStr *pStart)
 
- Protected Attributes inherited from IPullParser
IXMLReaderuReader
 
IXMLReadersourceUReader
 
IXMLAttributeallAttributes
 
int szByteBuffer
 
int _nAttribute
 
IXMLToken curToken
 
int depth
 
int _szText
 
long long nLine
 
bool _isEmptyNode
 
bool _isIgnorableSpace
 
bool _isInArray
 
IXMLError lastError
 
IXMLClear curClearTag
 
IXMLStr pContent
 
bool autoDetectSource
 
IXMLCharEncoding characterEncoding
 
const char * XML_ByteTable
 
IXMLReader_ToUTF16 charEncodingConverterToUTF16
 
IXMLReader_FromUTF16 charEncodingConverterFromUTF16
 
unsigned char * bufferChar
 
IXMLStr pCurrentPos
 
IXMLStr pEndPos
 
IXMLStr pStartOfLine
 
bool isStreamFinished
 

Detailed Description

Class Defining the Incredible XML Pull Parser.

This class defines the Incredible XML Pull Parser.
To create a new instance of the Incredible XML Pull Parser, you must provide 2 parameters:

  1. Parameter 1: an IXMLReader object that is used to "stream" data inside the parser.
  2. Parameter 2: a parameter that defines the size of the memory buffer used for streaming. More precisely: This parameter defines the size of buffer that is passed as first parameter of the IXMLReader::read() method.

    If the user-supplied value defines a buffer that is not big enough to contain one complete Token and its related data (i.e. one IXMLToken_Text or one IXMLToken_StartTag), then the Pull Parser will double the memory buffer size. The Incredible XML Pull Parser will continue to double the size of the memory buffer (amortized memory allocation) until it's large enough to contain one complete Token. When parsing the next tokens, the Pull Parser re-uses the same memory space, so that

A small value for the Parameter 2 might slow down the Pull Parser significantly because it will be forced to:

Definition at line 658 of file IXMLParser.h.

Constructor & Destructor Documentation

IXMLPullParser::IXMLPullParser ( IXMLReader uReader,
int  _szByteBuffer = 1024 *1024 
)
IXMLPullParser::~IXMLPullParser ( )

Member Function Documentation

void IXMLPullParser::clear ( )
virtual

Call this function when you have finished using this object to release memory used by the internal buffers.

Implements IPullParser.

int IXMLPullParser::getColumnNumber ( ) const
virtual

return the current column number expressed in byte or wchar

Reimplemented from IPullParser.

static IXMLCStr IXMLPullParser::guessXMLCharEncoding ( unsigned char *  b,
int  l,
IXMLChar  out[200] 
)
static

guess the Char Encoding of the text inside the buffer

static IXMLCharEncoding IXMLPullParser::guessXMLCharEncodingCode ( unsigned char *  b,
int  l 
)
static

guess the Char Encoding Code of the text inside the buffer

IXMLToken IXMLPullParser::nextToken ( )
virtual

read the data stream a little bit more to get the next token

Implements IPullParser.

void IXMLPullParser::reset ( )
virtual

re-start the pull parser (set token=IXMLToken_StartDocument)

This does not free the memory buffers and it also keeps the current char encoding settings.

Reimplemented from IPullParser.


The documentation for this class was generated from the following file: