|
[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: multiple elements with different names but same type
From: George Cristian Bina <george@oxygenxml.com>
Date: Tue, 18 Jan 2005 11:06:37 +0200 Message-ID: <41ECD19D.2010806@oxygenxml.com> To: Luke Graham <lukeg@multitrode.com.au> Cc: xmlschema-dev@w3.org Hi Luke, > I want to write something along these lines instead... > > <xs:element name="*" type="foo" minOccurs="0" maxOccurs="64"/> > > Is it possible? No, that is not possible. However it seems that the substitution groups are close to what you want. For instance if you have a schema like below: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:complexType name="foo"></xs:complexType> <xs:element name="abstractFoo" type="foo" abstract="true"/> <xs:element name="test"> <xs:complexType> <xs:sequence minOccurs="1" maxOccurs="64"> <xs:element ref="abstractFoo"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="a" type="foo" substitutionGroup="abstractFoo"/> <xs:element name="b" type="foo" substitutionGroup="abstractFoo"/> <xs:element name="c" type="foo" substitutionGroup="abstractFoo"/> <xs:element name="d" type="foo" substitutionGroup="abstractFoo"/> </xs:schema> then the test element can contain 1 to 64 elements from {a, b, c, d}. > And... I want to give a range to a simple integer, without deriving a > new type - > > <xs:element name="bar" type="xs:int" minInclusive="0" maxInclusive="10"/> This does not work like you write it, but you can have an anonymous type like below: <xs:element name="bar"> <xs:simpleType> <xs:restriction base="xs:int"> <xs:minInclusive value="0"/> <xs:maxInclusive value="10"/> </xs:restriction> </xs:simpleType> </xs:element> Hope that helps, George --------------------------------------------------------------------- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com Luke Graham wrote: > Hello list, > > I have a problem with some schemas that Im writing. They look as follows... > > <xs:complexType name="foo"/> > > <xs:element name="_1" type="foo"/> > <xs:element name="_2" type="foo"/> > ..... > > I want to write something along these lines instead... > > <xs:element name="*" type="foo" minOccurs="0" maxOccurs="64"/> > > Is it possible? > > And... I want to give a range to a simple integer, without deriving a > new type - > > <xs:element name="bar" type="xs:int" minInclusive="0" maxInclusive="10"/> > > Do I really have to derive a new type each time? That seems excessive. >Received on Tuesday, 18 January 2005 09:01:11 GMT |
Subscribe in XML format
|






