Hello relax-ng users.
I had some trouble getting jing to run under the javax.xml.validation
API but I finally succeeded and thought this might be interesting for
other relax ng users .

I combined jing-20030619, isorelax-20041111 and isorelax-jaxp-bridge
1.0. I found and fixed some bugs (see below) and made the whole thing
compile in jdk 1.5 and with recent versions of the libraries (see
build.xml).
Now it works but you must set the system property 
javax.xml.validation.SchemaFactory:http://relaxng.org/ns/structure/1.0
to
org.iso_relax.verifier.jaxp.validation.RELAXNGSchemaFactoryImpl 
manually. At least in my case it was not sufficient to have the jar
file on the class path.

I uploaded a binary jar and source zip (including the ant script) to
http://tech.groups.yahoo.com/group/rng-users/files/jing/

Using the jar file would look like this:
java -cp
"jing-20070318.jar;your-javax-xml-validation-aware-application.jar"
-Djavax.xml.validation.SchemaFactory:http://relaxng.org/ns/structure/1.0=org.iso_relax.verifier.jaxp.validation.RELAXNGSchemaFactoryImpl
your.MainClass


Here's a summary of the two most important bugs fixed:
*Jing*
In com.thaiopensource.relaxng.impl.PatternValidator and
com.thaiopensource.relaxng.jarv.VerifierHandlerImpl

PatternValidator called its public reset() method in its constructor.
VerifierHandlerImpl overrides reset() with a method that dereferences
an object that is assigned in its own constructor. Together, this
caused a NullPointerException when VerifierHandlerImpl(...) called
super(...).
Solution: put the reset code in PatternValidator into a private method
 resetImpl and make both PatternValidator(...) and reset() call
this method.

*JAXP-JARV-Bridge*
Assured that a validator will have a DraconianErrorHandler after
initialization or reset (as required by the spec). The unfixed code
set a null error handler on reset() which lead to the validator not 
emitting any errors.

M. Ringler












Reply via email to