You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Hank Wallace <ha...@gmail.com> on 2005/07/12 17:34:01 UTC

Well formed XML

I have searched the FAQ and Google'd, but I cannot find a way to
validate that the XML being processed is well formed. I don't want to
validate against a DTD.  Can someone point me in the right direction?

Thanks,
Hank

Re: Well formed XML

Posted by Ivan Bogouchev <iv...@gmail.com>.
Hi Hank,

when you succesfully parse the XML document (either with SAX or DOM) it 
means that it was well formed.
This validation is always performed.
If the XML were not well formed it would be reported as fatal error to the 
installed error handler (ErrorHandler or DOMErrorHandler classes)

Re: Well formed XML

Posted by Alberto Massari <am...@datadirect.com>.
At 12.10 12/07/2005 -0400, Hank Wallace wrote:
>I don't believe that is true.  I can pass the following string and
>Xerces will not raise an exception.
>
>"<xml><invalid>This is text</badtag>"

To check if the parse operation succeeded, call getErrorCount() and 
check if it's 0; if you need more comprehensive error messages, you 
will have to install an error handler using setErrorHandler().

Hope this helps,
Alberto


>Thanks,
>Hank
>
>On 7/12/05, Alberto Massari <am...@datadirect.com> wrote:
> > At 11.34 12/07/2005 -0400, Hank Wallace wrote:
> > >I have searched the FAQ and Google'd, but I cannot find a way to
> > >validate that the XML being processed is well formed. I don't want to
> > >validate against a DTD.  Can someone point me in the right direction?
> >
> > If you are talking about Xerces-C++, it will not accept a
> > non-well-formed XML; so, if the call to parse() succeeds, it's well-formed.
> >
> > Alberto
> >
> >
> >



Re: Well formed XML

Posted by Hank Wallace <ha...@gmail.com>.
I don't believe that is true.  I can pass the following string and
Xerces will not raise an exception.

"<xml><invalid>This is text</badtag>"

Thanks,
Hank

On 7/12/05, Alberto Massari <am...@datadirect.com> wrote:
> At 11.34 12/07/2005 -0400, Hank Wallace wrote:
> >I have searched the FAQ and Google'd, but I cannot find a way to
> >validate that the XML being processed is well formed. I don't want to
> >validate against a DTD.  Can someone point me in the right direction?
> 
> If you are talking about Xerces-C++, it will not accept a
> non-well-formed XML; so, if the call to parse() succeeds, it's well-formed.
> 
> Alberto
> 
> 
>

Re: Well formed XML

Posted by Alberto Massari <am...@datadirect.com>.
At 11.34 12/07/2005 -0400, Hank Wallace wrote:
>I have searched the FAQ and Google'd, but I cannot find a way to
>validate that the XML being processed is well formed. I don't want to
>validate against a DTD.  Can someone point me in the right direction?

If you are talking about Xerces-C++, it will not accept a 
non-well-formed XML; so, if the call to parse() succeeds, it's well-formed.

Alberto