OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: SAX: Error Reporting (question 4 of 10)

[ Lists Home | Date Index | Thread Index ]
  • From: James Clark <jjc@jclark.com>
  • To: xml-dev Mailing List <xml-dev@ic.ac.uk>
  • Date: Sun, 04 Jan 1998 06:56:35 +0700

David Megginson wrote:
> 
> Should SAX treat errors as events?  If so, should it distinguish fatal
> errors from warnings or non-fatal errors?
> 
>   public void warning (String message, String systemID, int line);
>   public void fatalError (String message, String systemID, int line);

There are 3 things that need to be distinguished:

- Fatal errors: violations of well-formedness constraints; processors
have to detect these and must stop normal processing.  In Java I think
an exception is the only reasonable way to handle these.  Unless you do
this people will be tempted to continue processing in violation of the
spec.

- Errors: violations of validity constraints or other errors that a
processor is not required to detect.

- Warnings: messages about conditions that do not cause a document to be
non-conforming.

To do a really good job of reporting these, much more information is
needed that a line number and a URL.  In particular you need more
information about the entity structure.  For example, given a document
doc.xml:

<!DOCTYPE doc SYSTEM "doc.dtd">
<doc>&e;</doc>

and doc.dtd:

<!ELEMENT doc (a)>
<!ENTITY e "<b/>">

nsgmls -e will say:

In entity e included from doc.xml:2:8
nsgmls:doc.dtd:2:15:E: element "b" undefined

There can be more than one relevant URL and line number.

This sort of facility also introduces major internationalization issues.

I can guarantee you are not going to be able to do a good job of error
reporting and still keep the interface simple.

James



xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS