Trang conversion and validation errors

This should cover W3C XML Schema, Relax NG and DTD related problems.
csjohnson
Posts: 2
Joined: Wed Oct 05, 2005 11:05 pm

Trang conversion and validation errors

Post by csjohnson » Wed Oct 05, 2005 11:28 pm

Hi,

I've been experimenting with James Clark's XHTML Modularization:
http://www.thaiopensource.com/relaxng/xhtml/

I downloaded the relaxng schema and validated a *simple* xhtml document against it in Oxygen 6.2. It validates no problem. So far so good.

I then convert the relax ng schema to a W3C XML schema, and use the resulting schema to validate the same XHTML document. This time I get a bunch of errors:

Location: 7:34
Description: E cos-nonambig: "http://www.w3.org/1999/xhtml":del and "http://www.w3.org/1999/xhtml":del (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.
URL: http://www.w3.org/TR/xmlschema-1/#cos-nonambig

Any help on this greatly appreciated.

-Chris

george
Site Admin
Posts: 2102
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Thu Oct 06, 2005 9:43 am

Hi Chris,

The XML Schema does not accept ambigous content as it is described in the URL reported in the error:
http://www.w3.org/TR/xmlschema-1/#cos-nonambig

That means for instance that you cannot have something like
x --> (a, b) | (a,c)

In general these problems are solved by rewriting the schema in a non ambiguous way, the above model for instance can be rewritten as:

x-->a,(b|c)

The rewriting is not always easy and TRANG does not do this automatically. Note that ambigous content is allowed in Relax NG.

You can configure oXygen not to perform UPA checks by disabling the full schema checking feature on the Options->Preferences / XML / XML Parser Options page but that will result in using only the first content rule when ambiguous content is present, in the above example the actual content model that will be used by the parser will be
X-->(a,b)

and if you have <X><a/><c/></X> that will be reported as invalid.

Best regards,
George

csjohnson
Posts: 2
Joined: Wed Oct 05, 2005 11:05 pm

Post by csjohnson » Thu Oct 06, 2005 10:05 am

Thanks George,

I'll take a look at http://www.w3.org/TR/xmlschema-1/#cos-nonambig ... still trying to wrap my head around this stuff(!) I wanted to experiment with extending XHTML using Mr. Clark's modularization - if I have to go on an 'ambiguity hunt', I might end up (re)writing the entire schema : (

Thanks again for your help and for a great product!

-Chris

Post Reply