[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] An issue?: Parsers with XML Schema support & reporting errors ininvalid
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?
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|