|Subject:||RE: DocBook TC action item reminder|
|From:||Rowland, Larry (larr...@hp.com)|
|Date:||Feb 9, 2006 12:43:23 pm|
c. Larry to test token string in both XSD and RNG validation.
In my notes, I had down investigating whether co-constraints expressed in RelaxNG were correctly mapped into W3C Schemas. The minutes say I am testing token strings. I am not familiar enough with the jargon to understand how the two relate, so I hope I covered what I was supposed to. I have to admit that I also used it to become more familiar with DocBook 5 and RelaxNG.
I developed the following sample with a mixture of various constraints on attributes and elements. Since I am new to RelaxNG, if I missed any co-constraints, let me know and I will repeat the testing with additional content. I have provided xml:id attributes for reference. The sample is minus the content used to access the Schemas.
<article> <title>Title</title> <info> <title>Title</title> </info> <para>This is a <bibliolist> <indexterm xml:id="A" class="singular" startref="B"/> <indexterm xml:id="B" class="startofrange" startref="A"/> <indexterm xml:id="C" class="endofrange" startref="B"/> <bibliomixed> <biblioid xml:id="D" class="other" otherclass="hi"/> <biblioid xml:id="E" otherclass="hi"/> <biblioid xml:id="F" class="other"/> </bibliomixed> </bibliolist></para> <para>This is the footnote without an admonition<footnote xml:id="G"> <para>Hi</para> </footnote></para> <para>This is the footnote with an admonition<footnote xml:id="H"> <caution> <para>Hi</para> </caution> </footnote></para> </article>
I consider the following to be errors: 1) No version attribute on the root element 2) title and info/title not allowed in same element 3) indexterm A should not allow a startref attribute 4) indexterm B should not allow a startref attribute 5) biblioid E should not allow otherclass (or should require class="other") 6) biblioid F should require the attribute otherclass 7) footnote H should not allow a caution admonition
I set up two files, one referencing the RelaxNG schema and the other the W3C XML schema. Both schemas were from the 5.0b3 download. The tests were done using oXygen 7.0, which uses Xerces2-J for schema validation and the Skeleton 1.5 for Schematron interpretation.
I performed five tests:
RelaxNG Validation (oXygen internal, using Xerces) RelaxNG validation with embedded Schematron (external, using Skeleton) W3C XML Schema validation (oXygen internal, using Xerces) W3C XML Schema validation with embedded Schematron (external, using Skeleton) Schematron validation (external, using Skeleton)
RelaxNg Validation ================== Correctly identified error 2: element "title" from namespace " Correctly identified errors 3 and 4: attribute "startref" not allowed at this point; ignored
Correctly identified errors 5 and 6 (if somewhat less helpfully): required attributes missing
Missed (as expected) errors 1 and 7
RelaxNg Validation with Embedded Schematron =========================================== Correctly identified all seven errors
W3C XML Schema Validation ========================= Claimed all three indexterms were in error (although "C" was not): Attribute 'startref' is not allowed to appear in element 'indexterm'
Failed to identify any other errors
W3C XML Schema Validation with Embedded Schematron ================================================== Exactly the same results as "W3C XML Schema Validation," as expected, since there are no Schematron rules embedded in the .xsd file.
Schematron Validation ===================== Found errors 1 and 7, as expected
A disclaimer about the W3C Schema is appropriate. The exact wording may require some word-smithing.
If it can be arranged, it would be preferable for the W3C schema to allow attributes in situations that are inappropriate rather than prohibiting them when they may be necessary.
A more thorough investigation of the differences between the W3C and RelaxNG schemas is probably appropriate, since the current failure to correctly map the RelaxNG into W3C schema is, at least in the case of indexterm startref attributes makes it impossible for a file valid according to the W3C schema to access some functionality that is bound to the grammar.
======================================================================= [ Larry Rowland | If you want to build a ship, don't drum ] [ ATCL | up the men to gather the wood, divide ] [ Hewlett-Packard | the work, and give orders. Instead, ] [ 3404 East Harmony Road | teach them to yearn for the vast and ] [ Fort Collins, CO 80528 | endless sea. - Antoine de Saint Exupery ] [ Phone: 970/898-2280 +-----------------------------------------] [ FAX: 970/898-2188 E-Mail:larry.rowland@.hp.com ] =======================================================================