I tried adding that and it gets caught but no message is being displayed.
The exception is being thrown by the parse function. It is unable to parse
the xml file.

Additionally, I am simply trying out the sample that is given on the xerces
website under the constructing a xercesDOM parser:
http://xerces.apache.org/xerces-c/program-dom-3.html#XercesDOMParser

All I have done is make the char pointer point to the string with my xml
file path.
I am surprised it is giving me errors due to this.





On Sat, Jan 30, 2010 at 7:20 PM, John Lilley <[email protected]> wrote:

> try adding:
>  catch (const SAXParseException& ex) {
>    // output this to see error string:   ex.getMessage();
>  }
>
> Also, if you run in the debugger and go to Debug -> Exceptions and tell it
> to trap thrown C++ exceptions, you will see the stack trace where Xerces is
> throwing.
>
> john
>
> ________________________________________
> From: Sanat Talmaki [[email protected]]
> Sent: Saturday, January 30, 2010 5:03 PM
> To: [email protected]
> Subject: Re: help in using parse function.
>
> I am unable to figure out why the exception is being thrown:
> 1) I tried setting the path to my xml file correctly:
>   const char* xmlFile = "C:\\Users\\Sanat\\Desktop\\CEM_Res\\Jan
> 2010\\xerces_test\\books.xml";
>
> 2) I set break points and found that the exception is not caught in
>  catch (const XMLException& toCatch)  OR
>  catch (const DOMException& toCatch) BUT caught in:
>
>  catch (...) {
>        cout << "Unexpected Exception \n" ;
>        return -1;
>
> What can i do to figure this out more. I have tried plugging away at this
> for quite a few hours now :(
>
>
> On Sat, Jan 30, 2010 at 7:00 PM, Sanat Talmaki <[email protected]
> >wrote:
>
> > Hi John,
> >
> > I did that, I got this message:
> > First-chance exception at 0x7649f328 in xerces_test.exe: Microsoft C++
> > exception: xercesc_3_0::SAXParseException at memory location 0x003eeac8..
> >
> > -sanat.
> >
> >
> > On Sat, Jan 30, 2010 at 6:56 PM, John Lilley <[email protected]
> >wrote:
> >
> >>
> >> It sounds like you need to catch a xerces exception.  Xerces throws
> >> exceptions on parse errors.  You also need to initialize Xerces or it
> will
> >> fail.
> >>
> >> You are using Visual Studio?  Go to Debug -> Exceptions menu and check
> the
> >> box to catch C++ exceptions when thrown.  That will break at the error
> >> location in the code.
> >> john
> >>
> >> ________________________________________
> >> From: Sanat Talmaki [[email protected]]
> >> Sent: Saturday, January 30, 2010 3:07 PM
> >> To: [email protected]; [email protected]
> >> Subject: Re: help in using parse function.
> >>
> >> I get the error at runtime:
> >> The thread 'Win32 Thread' (0x1e0c) has exited with code 0 (0x0).
> >> First-chance exception at 0x7649f328 in xerces_test.exe: Microsoft C++
> >> exception: xercesc_3_0::RuntimeException at memory location 0x0033f2dc..
> >> First-chance exception at 0x7649f328 in xerces_test.exe: Microsoft C++
> >> exception: xercesc_3_0::SAXParseException at memory location
> 0x0033db14..
> >> The program '[12040] xerces_test.exe: Native' has exited with code -1
> >> (0xffffffff).
> >>
> >> If anyone could give me some advice I would be extremely grateful.
> >>
> >> Thanks,
> >>
> >> Sanat.
> >>
> >>
> >>
> >>
> >> On Sat, Jan 30, 2010 at 5:06 PM, Sanat Talmaki <[email protected]
> >> >wrote:
> >>
> >> > Hi everybody,
> >> >
> >> > I just started using xerces a couple of days ago. I am trying to
> create
> >> a
> >> > DOM from an xml file saved on my pc. I used the function:
> >> >
> >> > const char* xmlFile = "C:\Users\Sanat\Desktop\CEM_Res\books.xml";
> >> >
> >> >     try {
> >> >         parser->parse(xmlFile);
> >> >
> >> >
> >>
> >
> >
>

Reply via email to