[Home] [By Thread] [By Date] [Recent Entries]
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@i... Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ To (un)subscribe, mailto:majordomo@i... the following message; (un)subscribe xml-dev To subscribe to the digests, mailto:majordomo@i... the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@i...)
|

Cart



