00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #define ULXR_NEED_EXPORTS
00031 #include <ulxmlrpcpp/ulxmlrpcpp.h>
00032
00033 #include <ulxmlrpcpp/ulxr_xmlparse.h>
00034 #include <ulxmlrpcpp/ulxr_except.h>
00035
00036
00037 namespace ulxr {
00038
00039
00040 ULXR_API_IMPL0 XmlParser::XmlParser()
00041 : ExpatWrapper()
00042 {
00043 }
00044
00045
00046 ULXR_API_IMPL(void) XmlParser::charData(const XML_Char *s, int len)
00047 {
00048 ULXR_TRACE(ULXR_PCHAR("XmlParser::charData(const XML_Char*, int)")
00049
00050
00051
00052
00053
00054 );
00055 states.top()->appendCharData(s, len);
00056 ULXR_TRACE(ULXR_PCHAR("XmlParser::charData(const XML_Char*, int) finished"));
00057 }
00058
00059
00060 ULXR_API_IMPL(bool) XmlParser::testStartElement(const XML_Char *name, const XML_Char ** )
00061 {
00062 throw XmlException(NotWellformedError,
00063 ulxr_i18n(ULXR_PCHAR("Problem while parsing xml structure")),
00064 getCurrentLineNumber(),
00065 ulxr_i18n(ULXR_PCHAR("unexpected opening tag: "))+ULXR_GET_STRING(name) );
00066 }
00067
00068
00069 ULXR_API_IMPL(bool) XmlParser::testEndElement(const XML_Char *name)
00070 {
00071 throw XmlException(NotWellformedError,
00072 ulxr_i18n(ULXR_PCHAR("Problem while parsing xml structure")),
00073 getCurrentLineNumber(),
00074 ulxr_i18n(ULXR_PCHAR("unexpected closing tag: "))+ULXR_GET_STRING(name) );
00075 }
00076
00077
00078 ULXR_API_IMPL(void) XmlParser::assertEndElement(const char *current, const char *expected)
00079 {
00080 ULXR_TRACE(ULXR_PCHAR("XmlParser::assertEndElement(const char*, const char*): ")
00081 << ULXR_PCHAR("\n curr: ")
00082 << ULXR_GET_STRING(current)
00083 << ULXR_PCHAR(" exp: ")
00084 << ULXR_GET_STRING(expected)
00085 );
00086 if (0 != strcmp(current, expected))
00087 throw XmlException(NotWellformedError,
00088 (CppString) ulxr_i18n(ULXR_PCHAR("Unexpected xml tag: ")) + ULXR_GET_STRING(current)
00089 + ulxr_i18n(ULXR_PCHAR(", wanted: ")) + ULXR_GET_STRING(expected),
00090 getCurrentLineNumber(),
00091 ulxr_i18n(ULXR_PCHAR("Document not wellformed")));
00092 }
00093
00094
00095 }
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108