When you create a parser you must take care to set up the token values for your tags correctly. These values only have a limited range. And the range also varies if attributtes are used or if it is an empty element.
ulxr_wbxmlparse.h
contains constants for
the ranges.
wbxml_TAG_FIRST
, wbxml_TAG_LAST
boundaries for empty elements without attributes
wbxml_TAG_C_FIRST
, wbxml_TAG_C_LAST
boundaries for elements with content but without attributes
wbxml_TAG_A_FIRST
, wbxml_TAG_A_LAST
boundaries for empty elements with attributes. Currently not used as attributes are not supported.
wbxml_TAG_AC_FIRST
, wbxml_TAG_AC_LAST
boundaries for elements with content and attributes. Currently not used as attributes are not supported.
ulxmlrpcpp uses this technique to model the parsers for the XML-RPC tags MethodResponse or MethodCall which both include Value.
class ValueParserWb : public WbXmlParser { enum ValueWellKnownToken { wbToken_Value = wbxml_TAG_C_FIRST, // 0x45 wbToken_Array, // 0x46 ... wbToken_Date, // 0x51 wbToken_ValueParserLast // 0x52 } ... class MethodResponseParserWb : public ValueParserWb, { enum RespWellKnownToken { wbToken_MethodResponse = ValueParserWb::wbToken_ValueParserLast, // 0x52 wbToken_Fault, // 0x53 wbToken_Params, // 0x54 wbToken_Param, // 0x55 wbToken_ResponseParserLast // 0x56 };
For more examples on the working method see the various *parse_wb.cpp files.