W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2001

Re: ASN.1 => XML Schema questions

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Mon, 25 Jun 2001 09:31:38 +0200
Message-ID: <3B36E8DA.FF88E64F@dyomedea.com>
To: Geoff Elgey <elgey@dstc.qut.edu.au>
Cc: xmlschema-dev@w3.org
Geoff Elgey wrote:
> 
> G'day,
> 
> [I've been looking through the archive and published standards but I
> didn't find anything on this topic.  Apologies if this has been
> discussed before or is an a FAQ]
> 
> I'm playing around with an ASN.1 to XML Schema translator, and most of
> the translations seem okay, except for the following:
> 
> 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 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.
 
> Is there a simply method of defining type aliases?
> 
> b) Repetition of <all>
> 
> In ASN.1 we can define a SET type, such as :
> 
> T1 ::= SET { x INTEGER, y BOOLEAN }
> 
> where a SET is a type whose elements can come in any order.
> 
> So looking at the XML Schema documentation, I can define this as
> follows:
> 
> <complexType name="T1">
> <all>
>   <element name="x" type="integer"/>
>   <element name="y" type="boolean"/>
> </all>
> </complexType>
> 
> There are also list types in ASN.1, such as the following:
> 
> T2 ::= SEQUENCE OF T1
> 
> This declares T2 to be a list of T1, and so a possible XML Schema for T2
> is:
> 
> <complexType>
> <sequence minOccurs="0" maxOccurs="unbounded">
>   <element name="T1" type="T1"/>
> </sequence>
> >/complexType>
> 
> However, it is also possible in ASN.1 to have a list of anonymous SET,
> such as:
> 
> T3 ::= SEQUENCE OF SET { a INTEGER, b BOOLEAN }
> 
> But it appears that neither of the following types are legal in XML
> Schema:
> 
> <complexType>
> <all minOccurs="0" maxOccurs="unbounded">
>   <element name="a" type="integer"/>
>   <element name="b" type="boolean"/>
> </all>
> </complexType>
> 
> ==> illegal because <all> can only have min & max of 0 or 1
> 
> <complexType>
> <sequence minOccurs="0" maxOccurs="unbounded">
>   <all>
>     <element name="a" type="integer"/>
>     <element name="b" type="boolean"/>
>   </all>
> </sequence>
> </complexType>
> 
> ==> illegal as <all> cannot be nested within <sequence>
> 
> 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>

Hope this helps.

Eric

> Any help greatly appreciated.
> 
> 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

-- 
Pour y voir plus clair dans la nebuleuse XML...
                                          http://dyomedea.com/formation/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------
Received on Monday, 25 June 2001 03:31:51 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:21 GMT