Hi Jordan, I'm not available to the list Mon-Thur and I'm catching up. I
didn't see anyone respond to this so I will give it a shot.  I have noticed
that if the filename given to the parser to parse is invalid, that the
parser neither calls an error handler or throws an exception.  It simply
instantiates an empty document of which the first element is basically NULL.
Hence, the following three lines will work.

                        parser->parse(xmlFile);
                        DOM_Document doc = parser->getDocument();     //
Empty document
                        DOM_Element root = doc.getDocumentElement(); //
first element of an empty document contains an internal NULL 'fImpl'.

'root' ends up having an internal 'fImpl' member of NULL. The
'getElementsByTagName()' call tries to access this NULL 'fImpl' pointer and
hence, blows up. So one suggestion I can offer up is to verify your
'xmlFile' path to the DOMParser::parse(xmlFile') routine.



> -----Original Message-----
> From: J. Chong [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, June 26, 2001 5:44 AM
> To:   [EMAIL PROTECTED]
> Subject:      Help on Application Error
> 
> Dear all,
> 
>       I am very new to Xerces-C. I have the following codes (in MSVC++)
> 
>       I am trying to build the .EXE for the following codes. The
> compilation is OK. But when I tried to run this code, some problem
> happens. System complains on Application Error. I have checked it... and
> it happens at the DOM_NodeList... Please help. I am struggling.... Please
> help. Thanks. Wish you all the best.
> 
> 
> #include <util/PlatformUtils.hpp>
> #include <util/XMLString.hpp>
> #include <util/XMLUniDefs.hpp>
> #include <dom/DOM.hpp>
> #include <parsers/DOMParser.hpp>
> int main(int argc, char* argv[])
> {
>       char *xmlFile = "me.xml";       
>       DOMString nodeValue;
>       DOMString nodeName;
>       try {
>               XMLPlatformUtils::Initialize();
>       } catch (const XMLException &toCatch) {
>               cout << "Error during initialization! :\n"
>                        << toCatch.getMessage() << "\n";
>               return 1;
>       }
>       DOMParser *parser = new DOMParser();
>       try {
>               parser->parse(xmlFile);
>               DOM_Document doc = parser->getDocument();       
>               DOM_Element root = doc.getDocumentElement();
>               DOM_NodeList list =
> root.getElementsByTagName("ENABLINGBITS");
>       } catch (const XMLException &toCatch) {
>               cout << "\nFile not found: " << xmlFile << "\n"
>                        << "Exception message is: \n"
>                        << toCatch.getMessage() << "\n";
>               return -1;
>       }
>       XMLPlatformUtils::Terminate();  
>       return 0;
> 
> }
> 
> 
> 
> Best regards,
> Jordan CN CHONG 
> 
> 
> ---------------------------------------------------------------------
> 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