You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Wayne Bradney <Wa...@WallStreetSystems.com> on 2001/03/28 17:21:08 UTC
RE: Re: When does a SAXParser/XMLParser notify and error/warning/
fatal error?
Callista,
In general -
Warnings: there are very few. In fact I can't think of any warnings I've
seen with Xerces. With Sun's parser you used to get a warning with the SAX
1.0 ValidatingSAXParser if you didn't specify a DOCTYPE.
Errors: Schema validation errors (eg. missing required attributes, missing
elements, undeclared attributes, undeclared elements, wrong type of data).
Fatal Errors: Malformed XML document, Malformed Schema document, Schema
syntax error.
Regards,
WMB
-----Original Message-----
From: callista [mailto:callista@simecity.com]
Sent: Wednesday, March 28, 2001 2:42 AM
To: xerces-j-user@xml.apache.org
Subject: Re:Re: When does a SAXParser/XMLParser notify and
error/warning/fatal error?
Thanks Matt for your reply but what I really wanted to know is what might
cause those methods to be invoked. What sort of mistakes in the xml file
generates a call to those methods? Missing close tag, missing required
attributes, etc ...?
What I actually wanted to know is if a missing required attribute generates
an error.
Callista
On Tue Mar 27 23:56:04 2001 MYT, you wrote:
>
> I was able to get this very thing to work just yesterday. If you're
> extending the DefaultHandler, make sure your method signatures are
exactly
> the same. Here is the handler class that I used with the SAX parser:
> public class SAXErrorHandler extends DefaultHandler {
>
> public SAXErrorHandler() {
> }
>
> public void error(SAXParseException spe) {
> System.out.println("Error in file \"" + spe.getSystemId() + "\""
> + ", line #" + spe.getLineNumber() + ": " + spe.toString
> ());
> }
>
> public void warning(SAXParseException spe) {
> System.out.println("Warning in file \"" + spe.getSystemId() +
"\""
> + ", line #" + spe.getLineNumber() + ": " + spe.toString
> ());
> }
>
> public void fatalError(SAXParseException spe) throws
> org.xml.sax.SAXException {
> System.out.println("Fatal Error in file \"" + spe.getSystemId() +
"
> \""
> + ", line #" + spe.getLineNumber() + ": " + spe.toString
> ());
> throw new org.xml.sax.SAXException(spe);
> }
> }
>
> Matt
>
>
>
> callista
> <callista@sim To:
xerces-j-user@xml.apache.org
> ecity.com> cc:
> Fax to:
> 03/27/01 Subject: When does a
SAXParser/XMLParser notify and
> 03:28 AM error/warning/fatal error?
> Please
> respond to
> xerces-j-user
>
>
>
>
>
>
> This is kind of urgent.
>
> I was wondering if anyone knows when a SAXParser or XMLParser notifies
the
> error/warning/fatalerror methods of the ErrorHandler. I thought that when
> an xml page does not fulfill the syntax of a dtd it would generate an
error
> for example when an attribute defined as #REQUIRED but is not specified
in
> the xml. Somehow, my program can't seem to be able to catch this error.
>
> How do I go about this? I need to make sure that everything that has been
> defined as #REQUIRED in the dtd is infact specified in the xml being
parsed
> and throws an error if it's not.
>
> Thanks.
>
> Callista Chuah
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org