You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by xu...@kodak.com on 2003/10/31 01:33:08 UTC

crash when using dom parser to parse an invalid xml file

Hi,

I am new to this mailing list, so please bear with me if this question had
been asked before.

I am using dom parser to parse an in memory xml string, the parser would
crash the whole application if the xml string is invalid -- for example,
one of the "<" is missing for one of the fields. I thought it would just
throw an exception --  does anybody have any idea how to prevent the crash
from happening?

Regards,
Xuefu





---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: crash when using dom parser to parse an invalid xml file

Posted by da...@us.ibm.com.



Are you catching the appropriate exceptions?  If not, your application will
crash.  See the sample applications and the documentation for more
information.

Dave



                                                                                                                                                    
                      xuefu.wang@kodak                                                                                                              
                      .com                     To:      xerces-c-dev@xml.apache.org                                                                 
                                               cc:      (bcc: David N Bertoni/Cambridge/IBM)                                                        
                      10/30/2003 04:33         Subject: crash when using dom parser to parse an invalid xml file                                    
                      PM                                                                                                                            
                      Please respond                                                                                                                
                      to xerces-c-dev                                                                                                               
                                                                                                                                                    



Hi,

I am new to this mailing list, so please bear with me if this question had
been asked before.

I am using dom parser to parse an in memory xml string, the parser would
crash the whole application if the xml string is invalid -- for example,
one of the "<" is missing for one of the fields. I thought it would just
throw an exception --  does anybody have any idea how to prevent the crash
from happening?

Regards,
Xuefu





---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


RE: crash when using dom parser to parse an invalid xml file

Posted by Erik Rydgren <er...@mandarinen.se>.
Input of malformed xml should neither throw nor crash. The parse method
should only return false and the error is reported through the
registered error handler.

Have you initialized Xerces before using any of the classes? Are you
linking with the correct runtime? Try parsing your input document with
the DOMCount example. If the crash persists there then you have found a
bug.

/ Erik

> -----Original Message-----
> From: xuefu.wang@kodak.com [mailto:xuefu.wang@kodak.com]
> Sent: den 31 oktober 2003 01:33
> To: xerces-c-dev@xml.apache.org
> Subject: crash when using dom parser to parse an invalid xml file
> 
> Hi,
> 
> I am new to this mailing list, so please bear with me if this question
had
> been asked before.
> 
> I am using dom parser to parse an in memory xml string, the parser
would
> crash the whole application if the xml string is invalid -- for
example,
> one of the "<" is missing for one of the fields. I thought it would
just
> throw an exception --  does anybody have any idea how to prevent the
crash
> from happening?
> 
> Regards,
> Xuefu
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org