W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2005

Re: xsd substitution groups weird problem

From: Kasimier Buchcik <K.Buchcik@4commerce.de>
Date: Thu, 17 Nov 2005 10:34:39 +0100
To: sreedevi crk <sreedevi_crk@yahoo.com>
Cc: ML-xml-schema-dev <xmlschema-dev@w3.org>
Message-Id: <1132220079.1272.10.camel@librax>

Hi,

I didn't test this, but I think in "VitalSigns3203.xml" the element
"signatureString" is not in the correct namespace (no namespace), as it
is declared in "Paticipation.xsd" to be in the namespace
"Participation".

The error report "One of '{"Participation":signatureText}' is expected."
is exactly reflecting this circumstance.

Try to put the "signatureString" element node in the namespace
"Paticipation".

Regards,

Kasimier


On Wed, 2005-11-16 at 08:33 -0800, sreedevi crk wrote:
> Hi all,
>  
> I am trying to solve the problem of validating instance documents of
> the substitution groups (with abstract elements and complex types)
> which is more than one level deep. 
>  
> Details and the xsds are 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 xsds instance document.
> The 3 xsds and the xml file code is below. The files related to A.1
> are Participation.xsd and Commons3202.xsd.
> The files related to A.2 are VitalSigns3203.xsd and
> VitalSigns3203.xml.
> 
> Participation.xsd has a complex abstract type. It is imported and a
> referenced as the data type of an abstract element in
> Commons3202.xsd. 
> Commons3202.xsd is imported to VitalSigns3203.xsd.
> 
> The validation of xml file generated from VitalSigns3203.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.
> 
> 
> 
> The code of each xsd file is as follows:
> ************************************************** ******************
> Paticipation.xsd:
> ************************************************** ******************
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:PARTICIPATION="Participation" targetNamespace="Participation">
> <!-- ================================================= -->
> <!-- Package: Participation -->
> <!-- ================================================= -->
> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
> <!-- Class: <<ST>> SignatureString -->
> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
> <xs:element name="signatureString"
> type="PARTICIPATION:SignatureString"
> substitutionGroup="PARTICIPATION:signatureText"/>
> <xs:complexType name="SignatureString">
> <xs:complexContent>
> <xs:extension base="PARTICIPATION:SignatureText">
> <xs:attribute name="value" type="xs:string" use="required"/>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
> <!-- Class: SignatureText -->
> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
> <xs:element name="signatureText" type="PARTICIPATION:SignatureText"
> abstract="true"/>
> <xs:complexType name="SignatureText" abstract="true"/>
> </xs:schema>
> **************************************************
> *********************
> Common3202.xsd:
> **************************************************
> *********************
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:CM3202="Common3202" xmlns:PARTICIPATION="Participation"
> targetNamespace="Common3202">
> <xs:import namespace="Participation"
> schemaLocation="Datatypes3203/RDT/Participation.xsd"/>
> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
> <!-- Class: <<Participation>> PractitionerParticipation -->
> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
> <xs:element name="practitionerParticipation"
> type="CM3202:PractitionerParticipation" abstract="true"/>
> <xs:complexType name="PractitionerParticipation" abstract="true">
> <xs:sequence>
> <!--xs:element name="signatureText" type="PARTICIPATION:SignatureText"
> minOccurs="0"/-->
> <xs:element ref="PARTICIPATION:signatureText"/>
> </xs:sequence>
> </xs:complexType>
> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
> <!-- Class: <<Participation>> Author -->
> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
> <xs:element name="author" type="CM3202:Author"
> substitutionGroup="CM3202 ractitionerParticipation"/>
> <xs:complexType name="Author">
> <xs:complexContent>
> <xs:extension base="CM3202:PractitionerParticipation"/>
> </xs:complexContent>
> </xs:complexType>
> 
> </xs:schema>
> ************************************************** ******************
> VitalSigns3203.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>
> 
> ************************************************** ******************
> VitalSigns3203.xml
> ************************************************** *****************
> <?xml version="1.0" encoding="UTF-8"?>
> <!--Sample XML file generated by XMLSpy v2005 rel. 3 U
> (http://www.altova.com)-->
> <VS3203:vitalSignsObservationEvent xmlns:VS3203="VitalSigns3203"
> xmlns:CM3202="Common3202"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="VitalSigns3203:\DOCUME~1\vhaislkondas\MYDOCU~1
> \VHIM3200\VitalSigns3203.xsd">
> <CM3202:author>
> <signatureString value="String"/> //shows ERROR at this line.
> </CM3202:author>
> </VS3203:vitalSignsObservationEvent>
>  
> 
> 
> ______________________________________________________________________
> Yahoo! FareChase - Search multiple travel sites in one click. 
Received on Thursday, 17 November 2005 09:34:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:51 GMT