At 20.14 12/03/2007 +0000, Stephen Collyer wrote:
This may be a trivial question but I can't see an obvious answer
so feel free to flame if I'm being idiotic ..
Is there a straightforward way of distinguishing a non-well-formed
XML error from an invalid XML error, when running Xerces in validating
mode ?
Hi Steve,
that isn't a trivial question....
The only way I can see is that you create a new parser class by
deriving either XercesDOMParser or SAXParser, and override the
error( const unsigned int code
, const XMLCh* const errDomain
, const XMLErrorReporter::ErrTypes errType
, const XMLCh* const errorText
, const XMLCh* const systemId
, const XMLCh* const
, const XMLSSize_t lineNum
, const XMLSSize_t colNum)
method. At that point, if errDomain is XMLUni::fgValidityDomain
("http://apache.org/xml/messages/XMLValidity"), it's a validation
error; if it's XMLUni::fgXMLErrDomain
("http://apache.org/xml/messages/XMLErrors") it's a well-formedness error.
Be sure to call the base class method, in order to preserve the
original functionality of the parser.
Hope this helps,
Alberto