Skip to main content

xsd substitution groups

1 reply [Last post]
xmlnewcomer
Offline
Joined: 2005-11-15

I am new to xml/xsd world.

I have used substitution groups as follows:

A.1) I tried using abstract complex type/element with substitution groups that are two levels deep.
A.2) But I am unable to validate the calling xsd’s instance document.
The 3 xsds and the xml file code is below. The files related to A.1 are XX1.xsd and YY1.xsd.
The files related to A.2 are ZZ1.xsd and ZZ1.xml.

XX1.xsd has a complex abstract type. It is imported and a referenced as the data type of an abstract element in YY1.xsd.
YY1.xsd is imported to ZZ1.xsd.

The validation of xml file generated from ZZ1.xsd fails giving the below error:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'signature String'. One of '{"Participation":signatureText}' is expected.
The above error is reproducible in xmlspy, stylus, xerces and jaxp 1.1

Please let me know what is wrong with the code and any help in this regard at the earliest is highly appreciated.

B) Also I want to know the following:
1) The differences between element and complex type being declared as abstract in case of substitution groups.
2) Can xsi:type usage allowed in instance documents in case of substitution groups.

The code of each xsd file is as follows:
************************************************** ******************
XX1.XSD:
************************************************** ******************
<?xml version="1.0" encoding="ISO-8859-1"?>

************************************************** *********************
YY1.xsd:
************************************************** *********************
<?xml version="1.0" encoding="ISO-8859-1"?>

************************************************** ******************
ZZ1.xsd
************************************************** *****************
<?xml version="1.0" encoding="ISO-8859-1"?>

Hi all,
I am new to xml/xsd world. I want to know the differences between complex type and element being abstract and if both can be declared so, in case of substitution goups.Also can xsi:type usuage allowes in instance doucments in case of substitution goups.
I tried using abstarct complex type/element with substitution groups and I attached the code below.
In XX1.xsd which is imported and a reference to complex abstract type is made in YY1.xsd. But the instance document validation of ZZ1.xsd fails when YY1.xsd is imported to ZZ1.xsd and when the complex type is referenced. XMLSpy and Xerces give the same error as follows:This file is not valid. Unexpected element'signatureString' in element author. Expected signatureString,signatureText.
Please let me know what is wrong with the code and any help in this regard at the earliest is highly appeciated.

The code of each xsd file is as follows:
************************************************** ******************
XX1.XSD:
************************************************** ******************
<?xml version="1.0" encoding="ISO-8859-1"?>

************************************************** *********************
YY1.xsd:
************************************************** *********************
<?xml version="1.0" encoding="ISO-8859-1"?>

************************************************** ******************
ZZ1.xsd
************************************************** *****************
<?xml version="1.0" encoding="ISO-8859-1"?>

************************************************** ******************
ZZ1.xml
************************************************** *****************
<?xml version="1.0" encoding="UTF-8"?>

//shows ERROR at this line.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sekhar
Offline
Joined: 2003-06-25

The questions here are related about usage of XML Schema features and not about JAXB's binding of XML Schema features to Java. So please redirect to your questions to an alternate forum (for e.g. xmlschema-dev@w3.org ).