Altova Mailing List Archives


Re: XML Spy and complex type restriction

From: Eddie Robertsson <erobertsson@-------.---.-->
To: Matteo Garutti <m.garutti@--------------.--->
Date: 5/29/2002 7:43:00 PM
Hi,

Matteo Garutti wrote:

> Hi !
> Let's take a look at the following example: we have a BaseLibrary schema in
> which we have defined a complex type named "BaseType" which is a simple
> extension of xs:string; in another schema, FinalSchema.xsd, we have defined
> 2 elements which derives by restriction from the "BaseType"; the first
> element "child_1" fixes the length to two chars, the second one "child_2"
> fixes the length to four chars. Eventually we created an XML document based
> on FinalSchema.xsd, and we set the content of "child_1" and "child_2" nodes
> according to their types as defined in the schema.
> Then, we have tried to validate this XML document using 4 different XML
> engines and, unfortunately, we got different results:
>
> (1) XMLSpy">XMLSpy 4.2                                         --> Ok, the document
> is valid
> (2) Microsoft .NET ValidatingReader Object      --> Ok, the document is
> valid
> (2) XMLSpy">XMLSpy 4.3                                         --> Error, value
> does not macth facet length="4" in element dn:child_1
> (4) XMLSpy">XMLSpy 4.4                                 --> Error, value does not
> macth facet length="4" in element dn:child_1
>
> It seems that XMLSpy">XMLSpy (4.3 - 4.4) recognizes only the last restriction of
> the complex type "BaseType".
> It's somewhat stange that XMLSpy">XMLSpy changed its behaviour in its two last
> releases, isn't it ?
> Which is the right behaviour according to W3C standard ??

Your schema looks fine to me so I would suggest that a bug was introduced in the
later versions of XMLSpy">XMLSpy.

Cheers,
/Eddie

> ---------------
> BaseLibrary.xsd
> ---------------
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema targetNamespace="urn:BaseNamespace" xmlns:mq="urn:BaseNamespace"
> xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
> attributeFormDefault="qualified">
>         <xs:complexType name="BaseType">
>                 <xs:simpleContent>
>                         <xs:extension base="xs:string"/>
>                 </xs:simpleContent>
>         </xs:complexType>
> </xs:schema>
>
> ----------------
> FinalSchema.xsd
> ----------------
> <xs:schema targetNamespace="urn:DerivedNamespace"
> xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:bn="urn:BaseNamespace"
> elementFormDefault="qualified" attributeFormDefault="qualified">
>         <xs:import namespace="urn:BaseNamespace"
> schemaLocation="BaseLibrary.xsd"/>
>         <xs:element name="root">
>                 <xs:complexType>
>                         <xs:sequence>
>                                 <xs:element name="parent">
>                                         <xs:complexType>
>                                                 <xs:sequence>
>                                                         <xs:element
> name="child_1">
>
> <xs:complexType>
>
> <xs:simpleContent>
>
> <xs:restriction base="bn:BaseType">
>
> <xs:length value="2"/>
>
> </xs:restriction>
>
> </xs:simpleContent>
>
> </xs:complexType>
>                                                         </xs:element>
>                                                         <xs:element
> name="child_2">
>
> <xs:complexType>
>
> <xs:simpleContent>
>
> <xs:restriction base="bn:BaseType">
>
> <xs:length value="4"/>
>
> </xs:restriction>
>
> </xs:simpleContent>
>
> </xs:complexType>
>                                                         </xs:element>
>                                                 </xs:sequence>
>                                         </xs:complexType>
>                                 </xs:element>
>                         </xs:sequence>
>                 </xs:complexType>
>         </xs:element>
> </xs:schema>
>
> ------------------
> FinalDocument.xml
> ------------------
> <dn:root xmlns:dn="urn:DerivedNamespace" xmlns:bn="urn:BaseNamespace"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="urn:DerivedNamespace FinalSchema.xsd">
>         <dn:parent>
>                 <dn:child_1>12</dn:child_1>
>                 <dn:child_2>1234</dn:child_2>
>         </dn:parent>
> </dn:root>

From xmlschema-dev-request@t... Wed May 29 03:40:04 2002
Received: from tux.w3.org (tux.w3.org [18.29.0.27])
	by frink.w3.org (8.11.6+Su

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.