Thanks, good to think of!

I renamed the directory to

String xmlFile = "file:///C:/temp/Nymapp/DAOConfiguration.xml";

But Xerces still throws the exception.

Magnus Karlsson

-----Ursprungligt meddelande-----
Fran: Neil Graham [mailto:[EMAIL PROTECTED]
Skickat: den 7 september 2003 23:59
Till: [EMAIL PROTECTED]
Amne: Re: EndOfEntityException when calling DOMBuilder::parseURI




Hi Magnus,

Note that URI's don't permit the space (0x20) character directly; you need
to escape it.  Try replacing the spaces in the URI you're passing to the
parser with "%20" (without the quotes of course).

Hope that helps,
Neil
Neil Graham
XML Parser Development
IBM Toronto Lab
Phone:  905-413-3519, T/L 969-3519
E-mail:  [EMAIL PROTECTED]

Hi!

I am using Xerces 2.2.0 and BCB 5.

I have stripped DOMCounter to a minimum, but when I am running it a receive
EndOfEntityException. Is this normal or I am doing something wrong?

Magnus Karlsson

    DOMDocument *doc = NULL;
    // Initialize the XML4C system


    try {


        XMLPlatformUtils::Initialize();


    } catch (const XMLException &e) {


         memo->Lines->Add("Error during initialization.");


         memo->Lines->Add(e.getMessage());


         return;


    }


    // Instantiate the DOM parser.


    static const XMLCh gLS[] = { chLatin_L, chLatin_S, chNull };


    DOMImplementation *impl =
DOMImplementationRegistry::getDOMImplementation(gLS);


    DOMBuilder *parser =
((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYN
CHRONOUS,
 0);





    parser->setFeature(XMLUni::fgDOMNamespaces, false);


    parser->setFeature(XMLUni::fgXercesSchema, false);


    parser->setFeature(XMLUni::fgXercesSchemaFullChecking, false);


    parser->setFeature(XMLUni::fgDOMValidateIfSchema, false);





    // enable datatype normalization - default is off


    parser->setFeature(XMLUni::fgDOMDatatypeNormalization, true);





    // And create our error handler and install it


    XMLErrorHandler errorHandler;


    errorHandler.setOutput(memo);


    parser->setErrorHandler(&errorHandler);





    String xmlFile = "file:///C:/temp/Ny mapp (30)/DAOConfiguration.xml";


    try {


        errorHandler.resetErrors();


        // reset document pool


        parser->resetDocumentPool();


        doc = parser->parseURI(xmlFile.c_str());


    } catch (const XMLException &e) {


        memo->Lines->Add("Error during parsing: " + xmlFile);


        memo->Lines->Add(e.getMessage());


    } catch (const DOMException& e) {


        const unsigned int maxChars = 2047;


        XMLCh errText[maxChars + 1];





        memo->Lines->Add("DOM Error during parsing: " + xmlFile);


        memo->Lines->Add("DOMException code is: " + e.code);





        if (DOMImplementation::loadDOMExceptionMsg(e.code, errText,
maxChars))


             memo->Lines->Add("Message is: " + (String) errText);;


    } catch (Exception &e) {


        memo->Lines->Add("Unexpected exception during parsing: " +
xmlFile);


    }





    //


    //  Extract the DOM tree, get the list of all the elements and report
the


    //  length as the count of elements.


    //


    if (errorHandler.getHasErrors()) {





    } else {


        if (doc != NULL) {


            memo->Lines->Add("OK");


        } else {





        }


    }





    //


    //  Delete the parser itself.  Must be done prior to calling Terminate,
below.


    //


    parser->release();





    // And call the termination method


    XMLPlatformUtils::Terminate();





Magnus Karlsson


_________________________________________________


Magnus Karlsson


Consultant, M. Sc.





Transrail Sweden AB, Infosys


Torget 1, SE - 172 67 Sundbyberg


+46 8 404 09 94. +46 70 218 00 84


www.transrail.se










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


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

Reply via email to