XInclude exceptions - how to mirror Xerces J functionality into Xerces C++? 2007-02-04 - By Michael Glavassevich
Hi Simon,
Simon Rowland <srowlandx11@(protected)> wrote on 02/03/2007 05:45:21 PM:
> Hi there, > > I'm writing an XInclude module for the Xerces C++ parser. Currently I am
> writing a DOMDocument -> DOMDocument transformer. Next I will write a > SAX filter to do it live in the parse. > > I have a quick question about the Xerces-J implementation and it's > Exceptions. Basically I want to propagate XInclude error messages out of
> my module into the client application. > > My current thinking is to create a sublcass of XMLException, as many > other Xerces C++ internal errors do (e.g. PlatformUtils etc). This is > also the closest thing I can spot to a similar mechanism to the Xerces J
> XInclude code, which uses a XMLParseException which is a sublcass of the
> generic XNIException. > > My understanding of the spec is that it doesn't specify what we use, as > long as we stop doing the XInclude when we encounter a fatal error.
The XInclude spec doesn't say but the various XML APIs (SAX, DOM, JAXP, StAX, etc...) do specify how errors are reported. Xerces-J's internal error reporting mechanism was designed so that it could support them. This includes reporting the error to a registered error handler and throwing an exception with location information (e.g. SAXParseException and XMLStreamException) up to the application if the error was fatal or if the error handler threw an exception. If you're planning to add XInclude support to Xerces-C++ as a new SAX/DOM parser feature [1] and/or as a new parameter [2] for DOM normalization [3] you should use the error reporting mechanisms which already exist for these APIs.
> So any advice from those that have been down the XInclude investgiation > route already? Anything gratefully received! > > Many thanks in advance, Simon Rowland. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: j-dev-unsubscribe@(protected) > For additional commands, e-mail: j-dev-help@(protected)
[1] http://xerces.apache.org/xerces2-j/features.html#xinclude [2] http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/DOMConfiguration .html [3] http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/Document.html #normalizeDocument()
Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrglavas@(protected) E-mail: mrglavas@(protected)
--------------------------------------------------------------------- To unsubscribe, e-mail: j-dev-unsubscribe@(protected) For additional commands, e-mail: j-dev-help@(protected)
|
|