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

Re: xsd substitution groups weird problem

From: sreedevi crk <sreedevi_crk@yahoo.com>
Date: Thu, 17 Nov 2005 11:35:54 -0800 (PST)
Message-ID: <20051117193554.9450.qmail@web61113.mail.yahoo.com>
To: xmlschema-dev@w3.org
Hi
   
  I have errors while validating your modified xsds that you listed in your reply. It happens both in XMLSpy & Stylus. Please help. 
  Meanwhile I will try using w3c xsd validator to double check the validity of my original xsd files posted in this forum. 
   
  Following are the errors I was getting in your modified xsds:
  Error for Particiaption.xsd:
   
  file:///c:/VHIM3200/Datatypes3203/RDT/Participation-B.xsd:14,53: Schema Representation Constraint: Namespace 'Participation' is referenced without <import> declaration
  file:///c:/sree/VHIM3200/Datatypes3203/RDT/Participation-B.xsd:10,52: Schema Representation Constraint: Namespace 'Participation' is referenced without <import> declaration
   
  Error For Participation-B.xsd:
  Validating Participation-B.xsd...
  file:///c:/VHIM3200/Datatypes3203/RDT/Participation-B.xsd:8,45: The namespace of an <import> element must be different from the targetNamespace of the <import>ing schema
  file:///c:/sree/VHIM3200/Datatypes3203/RDT/Participation-B.xsd:15,53: Schema Representation Constraint: Namespace 'Participation' is referenced without <import> declaration
  file:///c:/sree/VHIM3200/Datatypes3203/RDT/Participation-B.xsd:11,52: Schema Representation Constraint: Namespace 'Participation' is referenced without <import> declaration
  The XML document Participation-B.xsd is NOT valid (3 errors)
  

Kasimier Buchcik <K.Buchcik@4commerce.de> wrote:
  Hi,

On Thu, 2005-11-17 at 08:00 -0800, sreedevi crk wrote:
> Hi Kasimier,
> 
> Thanks for the reply. 
> VitalSigns.xml validated fine by adding namespace as per your
> suggestion.
> But in my real world scenario, we have lot of levels of substitution
> groups and manual changes to the instance documents will be very hard.
> Thus wondering if there is any solution as this seems to be a bug in
> xsd/xml validation (i.e problem with namespace recognition in case of
> import statements in case of substitution groups two levels deep).
> Any help is highly appreciated.

I finaly found some time to test your scenario.

I don't think this is a bug related to validation; I think it's a
bug in the schema or in the instance document.
As already said, the element "signatureString" is declared in the
schema to be in the namespace "Participation". It obviously does
not match an element in no namespace. In order to create a schema
that eats the "signatureString" element in no namespace, you need
to declare such an element and put it in the substitution group
of the abstract "{Participation}signatureText" element declaration.

To be valid, I changed your scenario in the following way:

In "VitalSigns3203.xml":
- the value of xsi:schemaLocation is missing the namespace part

In "VitalSigns3203.xsd":
- The element "author" is either in the wrong namespace, or the
schema missed to _reference_ the declaration of "{Common3202}author".
I changed...

... to ...

... but seeing that in "Common3202.xsd" you put "{Common3202}author"
in the subtitution group of "{Common3202}practitionerParticipation",
I guess that the real intention was to declare:


In "Common3202.xsd":
- The value of the substitutionGroup attribute was mangled in your
mail (at least for me):
substitutionGroup="CM3202 ractitionerParticipation"/>
I changed the value to "CM3202:practitionerParticipation"

In "Participation.xsd":
- Removed the declaration of the element "signatureString" and
imported it from an additional schema with no targetNamespace.


The results of those changes:

The instance is valid according to Xerces-J 2.7.1, Saxon 8.5.1,
XSV 2.10 and Libxml2 2.6.22.
IBM's SQC and MSXML 4.0 SP2 bark about the schemata.
SQC reports: "VitalSigns3203 is not a valid absolute URI. No scheme
found in URI."
Seems like SQC (and maybe XSML) does not support 'wanna-be' URIs.

The new scenario:

VitalSigns3203.xml
------------------
xmlns:VS3203="VitalSigns3203"
xmlns:CM3202="Common3202"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="VitalSigns3203 VitalSigns3203.xsd">





VitalSigns3203.xsd
------------------
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:VS3203="VitalSigns3203"
xmlns:CM3202="Common3202">

schemaLocation="Common3202.xsd"/>

type="VS3203:VitalSignsObservationEvent"/>



 type="CM3202:Author" minOccurs="0"/-->

ref="CM3202:practitionerParticipation"/>




Common3202.xsd
--------------
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:CM3202="Common3202"
xmlns:PARTICIPATION="Participation">

schemaLocation="Participation.xsd"/> 

type="CM3202:PractitionerParticipation"
abstract="true"/>

abstract="true">





type="CM3202:Author"
substitutionGroup="CM3202:practitionerParticipation"/>










Participation.xsd
-----------------
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:PARTICIPATION="Participation">



type="PARTICIPATION:SignatureText"
abstract="true"/>




Participation-B.xsd
-------------------
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:PARTICIPATION="Participation">

   for "{Participation}signatureText" -->



substitutionGroup="PARTICIPATION:signatureText"/>




type="xs:string" use="required"/>





Regards,

Kasimier
  


		
---------------------------------
 Yahoo! FareChase - Search multiple travel sites in one click.  
Received on Thursday, 17 November 2005 19:36:03 GMT

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