When invoking the Xerces DOM-Parser with parser->parse(xmlFile)
I get this error message:
I do not know what´s wrong there, my xml file is valid against the DTD...


Fatal Error at file "/home/DOMParse/example.xml", line 1, column 39
Message: An exception occurred! Type:UTFDataFormatException, Message:invalid byte 2 (r) of a 6-byte sequence.


I´ve learned now, that this error coccurs always.
It does not matter which XML file I use. :-/

Any ideas out there?


--snip


        // Initialise Xerces-C
        try {
                XMLPlatformUtils::Initialize();
        }

        catch (const XMLException& toCatch) {
                char* message = XMLString::transcode(toCatch.getMessage());
                cout << "Error during initialization of XERCES! :\n" << message << 
"\n";
                XMLString::release(&message);
                return 2;
        }

        // set validation scheme: Default for validation scheme is Val_Always
        XercesDOMParser::ValSchemes valScheme = XercesDOMParser::Val_Always;
        if (valSchemeStr == "never")
                valScheme = XercesDOMParser::Val_Never;

        // create parser and do some settings
        XercesDOMParser* parser = new XercesDOMParser();
        parser->setValidationScheme(valScheme);
        parser->setDoNamespaces(false);
        parser->setIncludeIgnorableWhitespace(false);

        // create an error handler and install it
        DOMTreeErrorReporter *errReporter = new DOMTreeErrorReporter();
        parser->setErrorHandler(errReporter);

        try {
                parser->parse("x.xml");
        }
        catch (const XMLException& toCatch) {
                char* message = XMLString::transcode(toCatch.getMessage());
                cout << "An error occurred during parsing. Exception message is: \n"<< message 
<< "\n";
                XMLString::release(&message);
                XMLPlatformUtils::Terminate();

                return(2);
        }
        catch (const DOMException& toCatch) {
                char* message = XMLString::transcode(toCatch.msg);
                cout << "Exception message is: \n" << message << "\n";
                XMLString::release(&message);
                XMLPlatformUtils::Terminate();
                
                return(2);
        }
        catch (...) {
                cout << "Unexpected Exception!\n";
                XMLPlatformUtils::Terminate();
                return(2);
        }


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to