ulxr::ExpatWrapper Class Reference
[Low-level parser classes]

A wrapper for expat. More...

#include <ulxr_expatwrap.h>

Inheritance diagram for ulxr::ExpatWrapper:

Inheritance graph
[legend]
Collaboration diagram for ulxr::ExpatWrapper:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ExpatWrapper (bool createParser=true)
 Constructs an expat parser.
virtual ~ExpatWrapper ()
 Destroys the parser.
virtual int parse (const char *buffer, int len, int isFinal)
 Parse a pice of xml data.
virtual unsigned getErrorCode () const
 Gets the code for the current error.
virtual CppString getErrorString (unsigned code) const
 Gets the description for an error code.
virtual int getCurrentLineNumber () const
 Gets the line number in the xml data.
virtual int mapToFaultCode (int xpatcode) const
 Maps expat error codes to xml-rpc error codes.

Protected Member Functions

 operator XML_Parser () const
 Gets the parser instance.
virtual void startElement (const XML_Char *name, const XML_Char **atts)
 C++ callback for an opening XML tag.
virtual void endElement (const XML_Char *name)
 C++ callback for a closing XML tag.
virtual void charData (const XML_Char *s, int len)
 C++ callback for regular text from expat.

Static Protected Member Functions

static void startElementCallback (void *userData, const XML_Char *name, const XML_Char **atts)
 C-style callback for a closing XML tag from expat.
static void endElementCallback (void *userData, const XML_Char *name)
 C-style callback for an ending XML tag from expat.
static void charDataCallback (void *userData, const XML_Char *s, int len)
 C-style callback for regular text from expat.

Private Member Functions

void setHandler ()
 Sets the callback handlers.
void reset ()
 Resets the parser.

Private Attributes

XML_Parser expatParser

Detailed Description

A wrapper for expat.

Definition at line 43 of file ulxr_expatwrap.h.


Constructor & Destructor Documentation

ulxr::ExpatWrapper::ExpatWrapper ( bool  createParser = true  ) 

Constructs an expat parser.

Parameters:
createParser create a new parser instance

Definition at line 40 of file ulxr_expatwrap.cpp.

References expatParser, and setHandler().

ulxr::ExpatWrapper::~ExpatWrapper (  )  [virtual]

Destroys the parser.

Definition at line 51 of file ulxr_expatwrap.cpp.

References expatParser.


Member Function Documentation

int ulxr::ExpatWrapper::parse ( const char *  buffer,
int  len,
int  isFinal 
) [virtual]

Parse a pice of xml data.

Parameters:
buffer pointer start of next data chunk
len len of this chunk
isFinal true: last call to parser
Returns:
error condition, 0 = ok

Implements ulxr::XmlParserBase.

Definition at line 134 of file ulxr_expatwrap.cpp.

unsigned ulxr::ExpatWrapper::getErrorCode (  )  const [virtual]

Gets the code for the current error.

Returns:
error code

Implements ulxr::XmlParserBase.

Definition at line 140 of file ulxr_expatwrap.cpp.

CppString ulxr::ExpatWrapper::getErrorString ( unsigned  code  )  const [virtual]

Gets the description for an error code.

Parameters:
code error code
Returns:
pointer to description

Implements ulxr::XmlParserBase.

Definition at line 146 of file ulxr_expatwrap.cpp.

References ULXR_GET_STRING.

int ulxr::ExpatWrapper::getCurrentLineNumber (  )  const [virtual]

Gets the line number in the xml data.

Returns:
line number

Implements ulxr::XmlParserBase.

Definition at line 156 of file ulxr_expatwrap.cpp.

int ulxr::ExpatWrapper::mapToFaultCode ( int  xpatcode  )  const [virtual]

Maps expat error codes to xml-rpc error codes.

Parameters:
xpatcode error code from expat
Returns:
the according xml-rpc error

Implements ulxr::XmlParserBase.

Definition at line 88 of file ulxr_expatwrap.cpp.

References ulxr::InvalidCharacterError, ulxr::NotWellformedError, and ulxr::UnsupportedEncodingError.

ulxr::ExpatWrapper::operator XML_Parser (  )  const [protected]

Gets the parser instance.

void ulxr::ExpatWrapper::startElement ( const XML_Char *  name,
const XML_Char **  atts 
) [protected, virtual]

C++ callback for an opening XML tag.

Used ONLY internally as callback from expat.

Parameters:
name the name of the current tag
atts pointer to the current attributs (unused in XML-RPC)

Reimplemented in ulxr::MethodCallParser, ulxr::MethodResponseParser, and ulxr::ValueParser.

Definition at line 73 of file ulxr_expatwrap.cpp.

void ulxr::ExpatWrapper::endElement ( const XML_Char *  name  )  [protected, virtual]

C++ callback for a closing XML tag.

Used ONLY internally as callback from expat.

Parameters:
name the name of the current tag

Reimplemented in ulxr::MethodCallParser, ulxr::MethodResponseParser, and ulxr::ValueParser.

Definition at line 78 of file ulxr_expatwrap.cpp.

void ulxr::ExpatWrapper::charData ( const XML_Char *  s,
int  len 
) [protected, virtual]

C++ callback for regular text from expat.

Used ONLY internally.

Parameters:
s starting buffer with more data
len lenth of buffer

Reimplemented in ulxr::XmlParser.

Definition at line 83 of file ulxr_expatwrap.cpp.

void ulxr::ExpatWrapper::startElementCallback ( void *  userData,
const XML_Char *  name,
const XML_Char **  atts 
) [static, protected]

C-style callback for a closing XML tag from expat.

Used ONLY internally.

Parameters:
userData pointer to the actual C++-object
name the name of the current tag
atts to the current attributs (unused in XML-RPC)

Definition at line 112 of file ulxr_expatwrap.cpp.

void ulxr::ExpatWrapper::endElementCallback ( void *  userData,
const XML_Char *  name 
) [static, protected]

C-style callback for an ending XML tag from expat.

Used ONLY internally.

Parameters:
userData pointer to the actual C++-object
name the name of the current tag

Definition at line 121 of file ulxr_expatwrap.cpp.

void ulxr::ExpatWrapper::charDataCallback ( void *  userData,
const XML_Char *  s,
int  len 
) [static, protected]

C-style callback for regular text from expat.

Used ONLY internally.

Parameters:
userData pointer to the actual C++-object
s starting buffer with more data
len lenth of buffer

Definition at line 128 of file ulxr_expatwrap.cpp.

void ulxr::ExpatWrapper::setHandler (  )  [private]

Sets the callback handlers.

Definition at line 58 of file ulxr_expatwrap.cpp.

Referenced by ExpatWrapper().

void ulxr::ExpatWrapper::reset (  )  [private]

Resets the parser.

Definition at line 66 of file ulxr_expatwrap.cpp.


Member Data Documentation

XML_Parser ulxr::ExpatWrapper::expatParser [private]

Definition at line 147 of file ulxr_expatwrap.h.

Referenced by ExpatWrapper(), and ~ExpatWrapper().


The documentation for this class was generated from the following files:
Generated on Sun Aug 19 20:09:04 2007 for ulxmlrpcpp by  doxygen 1.5.1