- From: Udo Ende <u.ende@mid.de>
- Date: Thu, 15 Sep 2005 17:26:40 +0200
- To: <xmlschema-dev@w3.org>
Thanks Michael, sorry I want to do something different. I want to have "MiddleThree" and "MiddleFour" and much more inside "OuterOne" and "OuterTwo". Definitely "OuterOne" and "OuterTwo" will have different tags inside, but I took all other tags out trying to mention my problem. If I am getting up tp "MiddleThousand" I do have to write thousand refs in both. Because I have many "Outer" too, my schema explodes. With only one reference it would not explode. Is that clearer? Udo -----Ursprüngliche Nachricht----- Von: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] Im Auftrag von Michael Kay Gesendet: Donnerstag, 15. September 2005 11:23 An: 'Udo Ende'; xmlschema-dev@w3.org Betreff: RE: Referencing similar lists through a complexType There's something wrong with a design that uses element names "OuterOne" and "OuterTwo" and envisages extending this to "OuterThree" and "OuterFour". It suggests that you're packing data into the element names, whereas they should be used only to indicate the structure. Replace <OuterOne ...> with <Outer level="1" ...> and your processing will become much simpler. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: xmlschema-dev-request@w3.org > [mailto:xmlschema-dev-request@w3.org] On Behalf Of Udo Ende > Sent: 15 September 2005 09:25 > To: xmlschema-dev@w3.org > Subject: Referencing similar lists through a complexType > > > > Hi, > > this xml data is valid due to the following schema: > > <?xml version="1.0" encoding="ISO-8859-1"?> > <Example xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > <OuterOne id="Outer1"> > <MiddleOne id="Middle1_1"> > <Inner>8</Inner> > </MiddleOne> > <MiddleTwo id="Middle2_1"> > <Inner>6</Inner> > </MiddleTwo> > <MiddleOne id="Middle1_2"> > <Inner>3</Inner> > </MiddleOne> > <MiddleTwo id="Middle2_3"> > <Inner>1</Inner> > </MiddleTwo> > </OuterOne> > <OuterTwo id="Outer2"> > <MiddleTwo id="Middle2_2"> > <Inner>0</Inner> > </MiddleTwo> > <MiddleOne id="Middle1_3"> > <Inner>1</Inner> > </MiddleOne> > <MiddleOne id="Middle1_4"> > <Inner>5</Inner> > </MiddleOne> > </OuterTwo> > </Example> > > > <?xml version="1.0" encoding="UTF-8"?> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" > elementFormDefault="qualified"> > <xs:element name="Example"> > <xs:complexType> > <xs:sequence> > <xs:element ref="OuterOne"/> > <xs:element ref="OuterTwo"/> > </xs:sequence> > </xs:complexType> > </xs:element> > <xs:element name="OuterOne"> > <xs:complexType> > <xs:choice maxOccurs="unbounded"> > <xs:element ref="MiddleOne"/> > <xs:element ref="MiddleTwo"/> > </xs:choice> > <xs:attribute name="id" use="required" type="xs:NCName"/> > </xs:complexType> > </xs:element> > <xs:element name="OuterTwo"> > <xs:complexType> > <xs:sequence> > <xs:element ref="MiddleTwo"/> > <xs:element maxOccurs="unbounded" ref="MiddleOne"/> > </xs:sequence> > <xs:attribute name="id" use="required" type="xs:NCName"/> > </xs:complexType> > </xs:element> > <xs:element name="MiddleOne"> > <xs:complexType> > <xs:complexContent> > <xs:extension base="Inner"> > <xs:attribute name="id" use="required" type="xs:NCName"/> > </xs:extension> > </xs:complexContent> > </xs:complexType> > </xs:element> > <xs:element name="MiddleTwo"> > <xs:complexType> > <xs:complexContent> > <xs:extension base="Inner"> > <xs:attribute name="id" use="required" type="xs:NCName"/> > </xs:extension> > </xs:complexContent> > </xs:complexType> > </xs:element> > <xs:complexType name="Inner"> > <xs:sequence> > <xs:element ref="Inner"/> > </xs:sequence> > </xs:complexType> > <xs:element name="Inner" type="xs:integer"/> > </xs:schema> > > > Both "OuterOne" and "OuterTwo" do have "MiddleOne"s and > "MiddleTwo"s in it, > therefore the schema references both complexTypes "MiddleOne" and > "MiddleTwo". Assume there would be (much) more than only two > complexTypes, > so each "Outer..." must reference all of these. Therefore the > schema gets > bigger and bigger within each of the "Outer..." having the > same complexTypes > referenced. > Can I only reference ONE complexType inside of the "Outer..." > without having > the need of another tag? > > The following is a compromise, but with another tag called > "AnotherLevel": > > <?xml version="1.0" encoding="ISO-8859-1"?> > <Example xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > <OuterOne id="Outer1"> > <AnotherLevel> > <MiddleOne id="Middle1_1"> > <Inner>8</Inner> > </MiddleOne> > <MiddleTwo id="Middle2_1"> > <Inner>6</Inner> > </MiddleTwo> > <MiddleOne id="Middle1_2"> > <Inner>3</Inner> > </MiddleOne> > <MiddleTwo id="Middle2_3"> > <Inner>1</Inner> > </MiddleTwo> > </AnotherLevel> > </OuterOne> > <OuterTwo id="Outer2"> > <AnotherLevel> > <MiddleTwo id="Middle2_2"> > <Inner>0</Inner> > </MiddleTwo> > <MiddleOne id="Middle1_3"> > <Inner>1</Inner> > </MiddleOne> > <MiddleOne id="Middle1_4"> > <Inner>5</Inner> > </MiddleOne> > </AnotherLevel> > </OuterTwo> > </Example> > > and the schema: > > <?xml version="1.0" encoding="utf-8"?> > <xs:schema elementFormDefault="qualified" > xmlns:xs="http://www.w3.org/2001/XMLSchema"> > <xs:element name="Example"> > <xs:complexType> > <xs:sequence> > <xs:element ref="OuterOne" /> > <xs:element ref="OuterTwo" /> > </xs:sequence> > </xs:complexType> > </xs:element> > <xs:element name="OuterOne"> > <xs:complexType> > <xs:choice maxOccurs="unbounded"> > <xs:element ref="AnotherLevel" /> > </xs:choice> > <xs:attribute name="id" type="xs:NCName" use="required" /> > </xs:complexType> > </xs:element> > <xs:element name="OuterTwo"> > <xs:complexType> > <xs:choice maxOccurs="unbounded"> > <xs:element ref="AnotherLevel" /> > </xs:choice> > <xs:attribute name="id" type="xs:NCName" use="required" /> > </xs:complexType> > </xs:element> > <xs:element name="AnotherLevel"> > <xs:complexType> > <xs:choice maxOccurs="unbounded"> > <xs:element ref="MiddleOne" /> > <xs:element ref="MiddleTwo" /> > </xs:choice> > </xs:complexType> > </xs:element> > <xs:element name="MiddleOne"> > <xs:complexType> > <xs:complexContent mixed="false"> > <xs:extension base="Inner"> > <xs:attribute name="id" type="xs:NCName" use="required" /> > </xs:extension> > </xs:complexContent> > </xs:complexType> > </xs:element> > <xs:element name="MiddleTwo"> > <xs:complexType> > <xs:complexContent mixed="false"> > <xs:extension base="Inner"> > <xs:attribute name="id" type="xs:NCName" use="required" /> > </xs:extension> > </xs:complexContent> > </xs:complexType> > </xs:element> > <xs:complexType name="Inner"> > <xs:sequence> > <xs:element ref="Inner" /> > </xs:sequence> > </xs:complexType> > <xs:element name="Inner" type="xs:integer" /> > </xs:schema> > > > Can I do that without the need of the "AnotherLevel"-Tag??? > > Regards, > Udo > > >
Received on Thursday, 15 September 2005 15:26:59 UTC