#include <ulxr_wbxmlparse.h>
Inheritance diagram for ulxr::WbXmlParser:
Public Types | |
enum | WbXmlToken { wbxml_SWITCH_PAGE = 0x00, wbxml_END = 0x01, wbxml_ENTITY = 0x02, wbxml_PI = 0x43, wbxml_OPAQUE = 0xC3, wbxml_LITERAL = 0x04, wbxml_LITERAL_C = 0x44, wbxml_LITERAL_A = 0x84, wbxml_LITERAL_AC = 0xC4, wbxml_EXT_I_0 = 0x40, wbxml_EXT_I_1 = 0x41, wbxml_EXT_I_2 = 0x42, wbxml_EXT_T_0 = 0x80, wbxml_EXT_T_1 = 0x81, wbxml_EXT_T_2 = 0x82, wbxml_EXT_0 = 0xC0, wbxml_EXT_1 = 0xC1, wbxml_EXT_2 = 0xC2, wbxml_STR_I = 0x03, wbxml_STR_T = 0x83, wbxml_TAG_FIRST = 0x05, wbxml_TAG_LAST = 0x3f, wbxml_TAG_C_FIRST = 0x45, wbxml_TAG_C_LAST = 0x7F, wbxml_TAG_A_FIRST = 0x85, wbxml_TAG_A_LAST = 0xBF, wbxml_TAG_AC_FIRST = 0xC5, wbxml_TAG_AC_LAST = 0xFF } |
Public Member Functions | |
WbXmlParser () | |
Constructs a parser. | |
virtual int | parse (const char *buffer, int len, int isFinal) |
Parse a piece 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 error codes to xml-rpc error codes. | |
Static Public Attributes | |
static const char | wbxml_START_SEQ_STR [] |
static const unsigned | wbxml_START_SEQ_LEN |
Protected Types | |
typedef std::vector< Attribute > | Attributes |
Protected Member Functions | |
virtual | ~WbXmlParser () |
Destroys the parser. | |
bool | testStartElement (unsigned token, const Attributes &attr) |
Tests if the current opening tag is to be parsed by this inheritance level or by the parent. | |
virtual void | startElement (unsigned token, const Attributes &attr)=0 |
C++ callback for an opening XML tag. | |
bool | testEndElement () |
C++ callback for a closing XML tag. | |
virtual void | endElement ()=0 |
C++ callback for a closing XML tag. | |
virtual void | charData (const std::string &s) |
Parses the content of the current xml element. | |
Private Member Functions | |
void | init () |
Private Attributes | |
std::stack< WbXmlState > | wbxmlstates |
unsigned | wb_version |
unsigned | wb_pubId |
unsigned | wb_charset |
unsigned | lastErrorCode |
unsigned | tag_count |
Classes | |
class | Attribute |
struct | WbXmlState |
This is a very limitited implementation which only handles a subset which is enough for ulxmlrpcpp.
Definition at line 48 of file ulxr_wbxmlparse.h.
typedef std::vector<Attribute> ulxr::WbXmlParser::Attributes [protected] |
Definition at line 140 of file ulxr_wbxmlparse.h.
Definition at line 96 of file ulxr_wbxmlparse.h.
ulxr::WbXmlParser::~WbXmlParser | ( | ) | [protected, virtual] |
Destroys the parser.
The derived class is responsible for cleaning up stack<ParserState*>.
Definition at line 106 of file ulxr_wbxmlparse.cpp.
ulxr::WbXmlParser::WbXmlParser | ( | ) |
int ulxr::WbXmlParser::parse | ( | const char * | buffer, | |
int | len, | |||
int | isFinal | |||
) | [virtual] |
Parse a piece of xml data.
buffer | pointer start of next data chunk | |
len | len of this chunk | |
isFinal | true: last call to parser |
Implements ulxr::XmlParserBase.
Definition at line 118 of file ulxr_wbxmlparse.cpp.
References ulxr::HtmlFormHandler::makeHexNumber(), ulxr::HtmlFormHandler::makeNumber(), ulxr::NotWellformedError, ulxr::stBody, ulxr::stCharset, ulxr::stNone, ulxr::stPubId, ulxr::stStr_I, ulxr::stStrTableLen, ulxr_i18n, ULXR_PCHAR, and ULXR_TRACE.
unsigned ulxr::WbXmlParser::getErrorCode | ( | ) | const [virtual] |
Gets the code for the current error.
Implements ulxr::XmlParserBase.
Definition at line 111 of file ulxr_wbxmlparse.cpp.
CppString ulxr::WbXmlParser::getErrorString | ( | unsigned | code | ) | const [virtual] |
Gets the description for an error code.
code | error code |
Implements ulxr::XmlParserBase.
Definition at line 199 of file ulxr_wbxmlparse.cpp.
References ULXR_PCHAR.
int ulxr::WbXmlParser::getCurrentLineNumber | ( | ) | const [virtual] |
Gets the line number in the xml data.
Because the binary data has nothing like a line number, the current number of start tags is returned.
Implements ulxr::XmlParserBase.
Definition at line 205 of file ulxr_wbxmlparse.cpp.
int ulxr::WbXmlParser::mapToFaultCode | ( | int | xpatcode | ) | const [virtual] |
Maps error codes to xml-rpc error codes.
Compatibility function due to expat, always return input.
xpatcode | error code |
Implements ulxr::XmlParserBase.
Definition at line 211 of file ulxr_wbxmlparse.cpp.
bool ulxr::WbXmlParser::testStartElement | ( | unsigned | token, | |
const Attributes & | attr | |||
) | [protected] |
Tests if the current opening tag is to be parsed by this inheritance level or by the parent.
token | current well known token | |
attr | tag attributes |
Definition at line 237 of file ulxr_wbxmlparse.cpp.
References ulxr::HtmlFormHandler::makeHexNumber(), ulxr::NotWellformedError, ulxr_i18n, and ULXR_PCHAR.
Referenced by startElement(), and ulxr::ValueParserWb::startElement().
void ulxr::WbXmlParser::startElement | ( | unsigned | token, | |
const Attributes & | attr | |||
) | [protected, pure virtual] |
C++ callback for an opening XML tag.
token | current literal tag | |
attr | tag attributes |
Definition at line 230 of file ulxr_wbxmlparse.cpp.
References testStartElement().
bool ulxr::WbXmlParser::testEndElement | ( | ) | [protected] |
C++ callback for a closing XML tag.
Reimplemented in ulxr::MethodCallParserWb, ulxr::MethodResponseParserWb, and ulxr::ValueParserWb.
Definition at line 246 of file ulxr_wbxmlparse.cpp.
References ulxr::NotWellformedError, ulxr_i18n, and ULXR_PCHAR.
Referenced by ulxr::ValueParserWb::endElement().
virtual void ulxr::WbXmlParser::endElement | ( | ) | [protected, pure virtual] |
C++ callback for a closing XML tag.
Implemented in ulxr::MethodCallParserWb, ulxr::MethodResponseParserWb, and ulxr::ValueParserWb.
void ulxr::WbXmlParser::charData | ( | const std::string & | s | ) | [protected, virtual] |
Parses the content of the current xml element.
s | the current chunk of text |
Definition at line 217 of file ulxr_wbxmlparse.cpp.
References ULXR_GET_STRING, ULXR_PCHAR, and ULXR_TRACE.
void ulxr::WbXmlParser::init | ( | ) | [private] |
Definition at line 98 of file ulxr_wbxmlparse.cpp.
References ulxr::stNone.
Referenced by WbXmlParser().
const char ulxr::WbXmlParser::wbxml_START_SEQ_STR [static] |
Definition at line 134 of file ulxr_wbxmlparse.h.
Referenced by ulxr::MethodResponse::getWbXml(), and ulxr::MethodCall::getWbXml().
const unsigned ulxr::WbXmlParser::wbxml_START_SEQ_LEN [static] |
Definition at line 135 of file ulxr_wbxmlparse.h.
Referenced by ulxr::MethodResponse::getWbXml(), and ulxr::MethodCall::getWbXml().
std::stack<WbXmlState> ulxr::WbXmlParser::wbxmlstates [private] |
Definition at line 184 of file ulxr_wbxmlparse.h.
unsigned ulxr::WbXmlParser::wb_version [private] |
Definition at line 186 of file ulxr_wbxmlparse.h.
unsigned ulxr::WbXmlParser::wb_pubId [private] |
Definition at line 187 of file ulxr_wbxmlparse.h.
unsigned ulxr::WbXmlParser::wb_charset [private] |
Definition at line 188 of file ulxr_wbxmlparse.h.
unsigned ulxr::WbXmlParser::lastErrorCode [private] |
Definition at line 190 of file ulxr_wbxmlparse.h.
unsigned ulxr::WbXmlParser::tag_count [private] |
Definition at line 191 of file ulxr_wbxmlparse.h.