Red Hat Bugzilla – Bug 974650
libvirt schemas are not valid relaxng
Last modified: 2013-06-17 04:20:45 EDT
Description of problem:
While trying to take the libvirt relaxng schemas and get java classes from them, no matter the approach and auxiliary tool I would use, it would fail.
My particular problem was related with producing an xml configuration file representing a virtual machine. Later on this file would be used in an operation that registers a machine into a hypervisor in order to be able to (for example) power it on.
My original idea was to transform relaxng into xmlschema and then use jaxb to create the java classes as java's xjc support to relaxng is still experimental.
Tried relaxer and trang, this is not really working.
Then, decided to use xjc experimental support to generate java classes directly from relaxng schemas. Again, errors.
Version-Release number of selected component (if applicable):
latest version taken from git: http://libvirt.org/git/?p=libvirt.git;a=tree;f=docs/schemas;h=05ad5bb1695c317e05b9d599f34667030e1ced7f;hb=HEAD
Try to generate java classes from relaxng by running:
xjc -relaxng basictypes.rng (for example. The same problem applies to all schemas)
Steps to Reproduce:
[ERROR] datatype library "w3.org/2001/XMLSchema-datatypes"; not recognized line 7 of file:/home/susana/workspace/myProjs/libvirtschemas/rng/basictypes.rng
And a wide list of similar errors.
A set of compliant java classes.
Take the schemas and validate them using validator.nu web service (which uses Jing at the backend) to validate a random XML document against this schema. This produced a "Missing start element." error, which according to the RELAX NG tutorial is a required child element of <grammar/>. So it looks like at least this particular version of this particular schema is invalid RELAX NG.
I am not sure this will be the only issue, it is the first one that stops anything else from happening.
Hey DV, since you're the resident XML expert, can you weigh in here?
That's unrelated to Relax-NG it is about the datatype library for XML Schemas
(XSD) that can be used from Relax-NG. They are referred by namespace from
RNG and their namespace is defined in the XSD specification:
The usage of the XSD datatype as we did is suggested in the RelaxNG specification
itself in the RELAX NG schemas for RELAX NG :-)
In a nutshell the "experimental support from xjc" seems broken. The error is in
the Java generating toolset. Sorry not a libvirt bug !
W.r.t. the missing start element, basictypes.rng is not the validating
schemas, that's an included one, and doesn't have the have a <start>
Last point, a tutorial is not a normative reference, the specification is
so playing tricks on bug reports to try to push the bug on our side with
an invalid reference won't get you very far :-) . Read the full RNG spec
first, you're lucky, it's a matter of one hour !
Ok thanks, will do, but what validator should be used then?
Because the thing that led me to open a bug ticket was that in fact the validator was complaining about a missing element.