Validation against the XHTML2 RNG Schema as well as the XForms XSD schema

XHTML 2 uses RELAX NG, while XForms (to my regret) uses 
W3C XML Schema.  However, it is possible to combine 
these two schemas and validate XML documents against them.
We only have to use Namespace Routing Language (James Clark) [1], 
which is expected to become a basis of ISO/IEC DSDL Part 4.

I validated the HTML document (shown in G.1 of the XForms 
PR) against the combination of the XHTML2 RNG schema, the 
XForms WSD schema, and the user schema (payment.xsd).

Here is the schema I created for the combination 
of XHTML2.rng, XForms-Schema.xsd, and payment.xsd.

Since I could not find a convinent

<?xml version="1.0" encoding="UTF-8"?>
<rules startMode="root" xmlns="http://www.thaiopensource.com/validate/nrl">
    <mode name="root">
        <namespace ns="http://www.w3.org/2002/06/xhtml2">
           <validate schema="xhtml2.rng">
                <context path="head" useMode="inHeader"/>
           </validate>
        </namespace>
        <namespace ns="http://www.w3.org/2002/xforms">
            <validate schema="XForms-Schema.xsd"/>
        </namespace>
    </mode>
    <mode name="inHeader">
        <namespace ns="http://www.w3.org/2002/xforms">
            <validate schema="XForms-Schema.xsd" useMode="userSchema"/>
        </namespace>
    </mode>
    <mode name="userSchema">
        <namespace ns="http://commerce.example.com/payment">
            <validate schema="payment.xsd"/>
            <attach/>
        </namespace>
    </mode>
</rules>

Since I had to eliminate two ID attributes (which are 
not declared by XForms, some errors are reported.

$ java -jar /relax/ng/jing-20030619/bin/jing.jar combine.nrl html2.xml
c:\PR-xforms-20030801\dsdl\html1.xml:30:13: error: cvc-id.1: There is no ID/IDRE
F binding for IDREF 'fr'.
c:\PR-xforms-20030801\dsdl\html1.xml:97:14: error: cvc-id.1: There is no ID/IDRE
F binding for IDREF 's00'.

I also had to slightly change payment.xsd, since 
the user model contained in the example document 
is not valid against payment.xsd.

[1] http://www.thaiopensource.com/relaxng/nrl.html

Cheers,

Makoto

Received on Wednesday, 1 October 2003 01:07:50 UTC