Avitzur Alon wrote:
How do I set my own error reporter?

Extend the org.apache.xerces.impl.XMLErrorReporter[1] component and override the appropriate methods. The error reporter allows classes that implement Message- Formatter to be registered for various error domains to produce localized messages. If no formatter is available for that domain, though, it produces a more generic error message (similar to what I listed in my last message):

  message := domain '#' key ('?' arg ('&' arg)*)?

If you override the putMessageFormatter method to
do nothing, then no message formatters can be set and
the default error message will be generated. This can
then be easily parsed by the application.

Now you just need to set the property on the parser.
The property you set is not listed on the Properties
page because it's for an internal component. However,
it is listed in the XNI Manual[2]. Even though it's
internal, setting the property is the same as for a
public property[3].

[1] http://cvs.apache.org/viewcvs.cgi/xml-xerces/java/src/org/apache/xerces/impl/XMLErrorReporter.java?rev=1.11&view=auto
[2] http://xml.apache.org/xerces2-j/xni-xerces2.html#error-reporter
[3] http://xml.apache.org/xerces2-j/properties.html


P.S. I haven't tested this approach but this was the
idea behind the error reporter so it should work.

--
Andy Clark * [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to