"cvc-complex-type.2.4.b" error

Issues related with the oNVDL implementation of NVDL.
fchyq
Posts: 3
Joined: Mon May 21, 2007 10:02 am

"cvc-complex-type.2.4.b" error

Post by fchyq »

a.xsd:

<xs:schema xmlns:a="http://a" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://a" elementFormDefault="qualified">
<xs:element name="root_a">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" ref="a:a"/>
<xs:choice>
<xs:element ref="a:b"/>
<xs:any namespace="http://b" processContents="lax"></xs:any>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="a"/>
<xs:element name="b"/>
</xs:schema>

b.xsd:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://b" elementFormDefault="qualified">
<xs:element name="root_b">
<xs:complexType>
<xs:sequence>
<xs:element name="b1"/>
<xs:element name="b2"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

a.nvdl:

<rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0">
<namespace ns="http://a">
<validate schema="a.xsd"/>
</namespace>
<namespace ns="http://b">
<validate schema="b.xsd"/>
</namespace>
</rules>

a.xml:

<?oxygen NVDLSchema="a.nvdl"?>
<root_a xmlns="http://a">
<a>123</a>
<root_b xmlns="http://b">
<b1>1234</b1>
<b2>1234</b2>
</root_b>
</root_a>

there is a error:
cvc-complex-type.2.4.b: The content of element 'root_a' is not complete. One of '{"http://a":b, WC["http://b"]}' is expected.

is this a bug?
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi,

No, it is not a bug.
All you need is to attach sections from http://b namespace so that the validation with schema a.xsd will validate also the root_b from http://b namespace, matching it against the wildcard. Otherwise what you get to validate with schema a.xsd is

Code: Select all


<root_a xmlns="http://a">
<a>123</a>
</root_a>
which clearly needs either a:b or an element from the http://b namespace to be valid.

So, change the NVDL script as below:

Code: Select all


<rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"
xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0">
<namespace ns="http://a">
<validate schema="a.xsd"/>
</namespace>
<namespace ns="http://b">
<validate schema="b.xsd"/>
<attach/>
</namespace>
</rules>
Best Regards,
George
George Cristian Bina
fchyq
Posts: 3
Joined: Mon May 21, 2007 10:02 am

Post by fchyq »

yes,this is OK.thanks very much
Post Reply