[
Lists Home |
Date Index |
Thread Index
]
- From: Dylan Walsh <Dylan.Walsh@Kadius.com>
- To: Xml-Dev <xml-dev@lists.xml.org>
- Date: Thu, 12 Oct 2000 10:17:18 +0100
While researching XML Schemas, I have small concern regarding an issue that
could effect developers of applications that use schemas & supporting
parsers to validate XML. One difference between schemas and DTDs is that
schemas can express powerful constraints on the text content of elements, or
attribute values. This power is especially useful to people using XML for
data centric, rather than document centric applications. As schemas can
express more forms of constraints than DTDs, the range of potential errors
in a parsed document is greater.
Let's say, for example, that we are using a Java parser. Errors in the XML,
where it fails to meet the constraints in the schema, would typically be
reported by throwing an exception. The form of that exception for a
particular form of schema violation is outside of the specs, they just say
whether the document should be deemed valid or not (correct me if I'm
wrong).
Certain applications would need to know the precise reason for an XML
documents failures to validate, for example, to generate a user-friendly
error message for the user.
Therefore such an application would be closely coupled to particular form of
error reporting of the particular parser used. For example, Xerces appears
to put a descriptive text into the SAXParseException message, e.g. something
like "X is not allowed in Y". The application would need to "parse" the
parser error messages (no pun intended). Doing this could be difficult, and
switching parsers would involve a lot of recoding.
Perhaps there is a need for a formal or ad hoc standard for this reporting,
e.g. an extension to SAX, that specifies subclasses of SAXParseException for
different schema errors. Or is this already being dealt with?
|