- From: Geoff Elgey <elgey@dstc.qut.edu.au>
- Date: Mon, 25 Jun 2001 18:24:15 -0400 (EDT)
- To: vdv@dyomedea.com
- CC: xmlschema-dev@w3.org
G'day, Eric van der Vlist wrote: > > a) Aliasing a global type > > > > ASN.1 defines an INTEGER type, and I'd like to use a type called > > "INTEGER" rather than blindly substituting the equivalent XML Schema > > type "integer". That is, define a type called "INTEGER" that aliases the > > "integer" type. > > > > The best I could come up with was: > > > > <simpleType name="INTEGER"> > > <restriction base="integer"/> > > </simpleType> > > What's wrong with the above? > > IMHO, it's exactly doing what you want to achieve. I was wondering of there was a simply method of declaring aliases, rather than defining a restriction/extension. An alias would be of a form similar to: <typeAlias name="INTEGER" ref="integer"/> I also found I had to do the following when aliasing a complex type: <xsd:complexType name="ResourceReport"> <xsd:complexContent> <xsd:restriction base="EXTERNAL"/> </xsd:complexContent> </xsd:complexType> rather than: <xsd:complexType name="ResourceReport"> <xsd:restriction base="EXTERNAL"/> </xsd:complexType> (Note: I'm using XML Authority for schema checking here) So a simple methodfor aliasing a type would be most welcome. > I just find confusion prone the fact to rely on upper/lower cases to > distinguish between your INTEGER and W3C XML Schema's interger and I > would personaly use a different namespace. Agreed -- the above is for example purposes only. > > Is there any way to specify in XML Schema that a collection of elements > > that can appear in any order, and that each such collection can occur > > multiple times? > > Yes, the workaround for this is: > > <complexType> > <choice minOccurs="0" maxOccurs="unbounded"> > <element name="a" type="integer"/> > <element name="b" type="boolean"/> > </choice> > </complexType> Not quite -- the above definition is for (a|b)*, but I'm looking for definitions of the form (ab|ba)*. In fact, expanding this to the general case of N elements, there would be N! alternatives in the content, with [0..unbounded] occurrences of any particular alternative. I know that N! alternatives sounds daunting when performing schema validation -- is this why <all> cannot have repetitions or be nested within a <sequence> ? However, at first glance the algorithm for distinguishing alternative boundaries seems workable -- read tags until either (a) each element from the set has been found or (b) a repetition of an element is found, whichever comes first. Then validating of presence/absence of particular elements within the set can occur. But such an algorithm probably would not work for <all> nested within <all>. Comments? Suggestions? Cheers, Geoff -- Geoffrey Elgey ph: +61-7-38641487 Distributed Systems Technology Centre Security Unit fax:+61-7-38641282 QUT, Brisbane, Australia http://www.dstc.edu.au DSTC is the Australian W3C Office email: elgey@dstc.edu.au
Received on Tuesday, 26 June 2001 03:46:01 UTC