- From: Eddie Robertsson <erobertsson@allette.com.au>
- Date: Wed, 29 May 2002 09:43:15 +1000
- To: Matteo Garutti <m.garutti@cribisnetgroup.com>
- CC: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
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) XML Spy 4.2 --> Ok, the document > is valid > (2) Microsoft .NET ValidatingReader Object --> Ok, the document is > valid > (2) XML Spy 4.3 --> Error, value > does not macth facet length="4" in element dn:child_1 > (4) XML Spy 4.4 --> Error, value does not > macth facet length="4" in element dn:child_1 > > It seems that XML Spy (4.3 - 4.4) recognizes only the last restriction of > the complex type "BaseType". > It's somewhat stange that XML Spy 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 XML Spy. 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>
Received on Tuesday, 28 May 2002 19:30:15 UTC