Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: inconsistent results

From: "Michael Kay" <mike@--------.--->
To: "'Serkant Karaca'" <skaraca@-------------.--->, <xmlschema-dev@--.--->
Date: 10/21/2005 11:55:00 PM
Saxon also considers this schema valid.
 
It has to be said, however, that the rules for "chameleon includes" leave a
lot of room for interpretation, and in my view the facility is best avoided.
In this situation it seems a lot simpler to use xs:import.
 
Michael Kay
http://www.saxonica.com/


  _____  

From: xmlschema-dev-request@w... [mailto:xmlschema-dev-request@w...] On
Behalf Of Serkant Karaca
Sent: 21 October 2005 21:59
To: xmlschema-dev@w...
Subject: inconsistent results


I am getting inconsistent results from various validating parsers based on 
importing/including declaring an element as a simpleType that is created 
based on a union in a schema with no namespace.

Is it possible to define a simpleType using a union and specifying 
memberTypes without assigning a namespace?

I start with a schema with nonamespace that defines three simpleTypes the 
third being a union of the first two.  I include this within another schema 
that has a namespace and then access the union type definition 
"usZipOrCanadaPostal" (see below).  Both XSV and Xerces validate schema 
with this arrangement.  XMLSPY also validates with no error.  However, 
MSXML complains that it cannot find the two memberType definitions.

<xsd:schema
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
<http://www.w3.org/2001/XMLSchema> ;
      elementFormDefault="unqualified"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<http://www.w3.org/2001/XMLSchema-instance> ;>

<xsd:simpleType name="usZip">
   <xsd:restriction base="xsd:string">
     <xsd:pattern value="[0-9]{5}(-[0-9]{4})?"/>
   </xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="canadaPostal">
   <xsd:restriction base="xsd:string">
     <xsd:pattern value="([A-Za-z]\d[A-Za-z]( |-)\d[A-Za-z]\d)"/>
   </xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="usZipOrCanadaPostal">
   <xsd:union memberTypes="usZip canadaPostal"/>
</xsd:simpleType>

</xsd:schema>

This is the schema that includes the definitions.  It is considered valid 
in XSV, Xerces, and XMLSPY but not MSXML 4.0:

<xsd:schema
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<http://www.w3.org/2001/XMLSchema-instance> ;
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
<http://www.w3.org/2001/XMLSchema> ;
      xmlns:ns1="http://www.test.MemberTypes" <http://www.test.membertypes>
;
      xmlns="http://www.test.MemberTypes" <http://www.test.membertypes> ;
      targetNamespace="http://www.test.MemberTypes"
<http://www.test.membertypes> ;
      version="0.1"
      elementFormDefault="qualified">

<xsd:include schemaLocation="testComponent.xsd"/>

<xsd:element name="Address" type="AddressType"/>
  <xsd:complexType name="AddressType">
   <xsd:sequence>
    <xsd:element name="Name" type="xsd:string"/>
    <xsd:element name="Street" type="xsd:string"/>
    <xsd:element name="City" type="xsd:string"/>
    <xsd:element name="StateProvince" type="xsd:string"/>
    <xsd:element name="Country" type="xsd:string"/>
    <xsd:element name="PostalCode" type="usZipOrCanadaPostal"/>
   </xsd:sequence>
  </xsd:complexType>
</xsd:schema>

Also, If I alter the schema structure slightly so that I import (instead of 
include) the same type definitions (via a proxy schema),  MSXML still 
returns an error, XMLSPY now returns an error of an "unidentified value for 
memberTypes" and XSV and Xerces continue to validate without errors.

Serkant KARACA
Senior Software Engineer
Ankara/Turkey
http://dizi4.blogspot.com
http://www.internetteyim.net




transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent