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 Dean Roddey <dr...@portal.com> on 2001/06/19 19:43:56 UTC

RE: DOMParser does not report errors for XML that are not well-fo rmed

It does not throw an exception, it calls the error handler.

--------------
Dean Roddey
Software Geek Extraordinaire
Portal, Inc
droddey@portal.com



-----Original Message-----
From: jeetu.gulati@kanisa.com [mailto:jeetu.gulati@kanisa.com]
Sent: Tuesday, June 19, 2001 10:27 AM
To: xerces-c-dev@xml.apache.org
Subject: RE: DOMParser does not report errors for XML that are not well-fo
rmed


Peter,
You could also try this out with the MemParse sample code that comes along
with the package. If you modify the
string in gXMLInMemBuf variable in MemParse.cpp from a well-formed XML
string to a not well-formed one and try running the sample code, you will
see the behavior that I am seeing. That is, it does not throw an
XMLException ..... is this expected?
-Jeetu


> -----Original Message-----
> From: Peter A. Volchek [mailto:PeterV@ti.com.od.ua]
> Sent: Tuesday, June 19, 2001 10:19 AM
> To: xerces-c-dev@xml.apache.org
> Subject: Re: DOMParser does not report errors for XML that 
> are not well-formed
> 
> 
> ----- Original Message -----
> From: <je...@kanisa.com>
> To: <xe...@xml.apache.org>
> Sent: Tuesday, June 19, 2001 7:31 PM
> Subject: DOMParser does not report errors for XML that are 
> not well-formed
> 
> 
> > I am using a DOMParser instance to load XML from a string 
> or a file to a
> DOM
> > by calling the parse(InputSource...) method on the string. 
> When the XML
> > string is not well-formed, I do not get any exceptions (I 
> am catching
> > XMLException while parsing).
> >
> > So I looked at the MemParse sample code which uses a 
> SAXParser instance to
> > do the same thing and which has also set error handlers and document
> > handlers on the SAXParser instance. I modified the XML string in the
> sample
> > code so that it is no more well-formed. It too did not 
> report any errors
> as
> > well. Is this an expected behaviour? If so, then does one 
> have to set
> custom
> > document handlers on a parser instance and throw exceptions 
> if an XML that
> > is parsed is not well-formed? Or is there some other way to 
> do it as well?
> >
> > Thanks in advance,
> > Jeetu
> >
> 
> Didn't you forget to call parser.parse() ?
> Post the piece of code where you initializes the InputSource 
> and sets the
> Parser.
> 
> 
> Peter A. Volchek
> Software Engineer
> Metis International, Inc.
> PeterV@ti.com.od.ua
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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

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