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
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.
</xs:schema>
************************************************** ******************
ZZ1.xsd
************************************************** *****************
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:VS3203="VitalSigns3203" xmlns:CM3202="Common3202" targetNamespace="VitalSigns3203">
<xs:import namespace="Common3202" schemaLocation="Common3202.xsd"/>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- Class: <<Observation>> VitalSignsObservationEvent -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<xs:element name="vitalSignsObservationEvent" type="VS3203:VitalSignsObservationEvent"/>
<xs:complexType name="VitalSignsObservationEvent">
<xs:sequence>
<xs:element name="author" type="CM3202:Author" minOccurs="0">
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
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.
More info. regarding this problem: The error occurs when each xsd has a different namespace and thus has problem with imports.
It works fine when all the xsds are in the same namespace and when include statement is used.
But I want to avoid name collisions by using different namespaces.
Thus any input in this regard is highly appreciated.
Bookmarks