Re: ASN.1 => XML Schema questions

G'day,

Martin Duerst wrote:
> ><complexType name="T">
> ><all minOccurs="0" maxOccurs="unbounded">
> >     <element name="x" type="integer"/>
> >     <element name="y" type="integer"/>
> >     <element name="z" type="integer" minOccurs="0"/>
> ></all>
> ></complexType>
> >
> >So given the following input:
> >
> ><T><x>1</x><y>2</y><z>3</z><z>1</z><y>2</y><x>3</x><y>1</y><x>2</x><y>1</y>
> ><z>2</z></T>
> 
> This is a benign example. Just change it to:
> 
> <T><x>1</x><y>2</y><z>3</z><y>2</y><x>3</x><y>1</y><x>2</x><y>1</y><z>2</z></T>
> 
> Now, does this parse as:
> 
> >complexType: T
> >content: list
> >    item 1 = <x>1</x><y>2</y><z>3</z>
> >    item 2 = <y>2</y><x>3</x>
> >    item 3 = <y>1</y><x>2</x>
> >    item 4 = <y>1</y><z>2</z> <== error: missing element 'x'
> 
> or as:
> 
> >complexType: T
> >content: list
> >    item 1 = <x>1</x><y>2</y>
> >    item 2 = <z>3</z><y>2</y><x>3</x>
> >    item 3 = <y>1</y><x>2</x>
> >    item 4 = <y>1</y><z>2</z> <== error: missing element 'x'
> 
> No way to decide, I guess.

I've already found this ambiguity, and I guess that shoots down any
reason I have for using <all> with maxOccurs > 1.
 
> > > > So your options are either
> > > >
> > > > - stick to W3C XML Schema and make a compromise by using (a|b)* rather
> > > >   than (ab|ba)*.
> 
> I'm confused. Is (ab|ba)* really what what was needed?
> This is completely deterministic, as far as I understand.
> It therefore should be allowed in DTDs, and if it doesn't
> work in Schemas, that would be a big problem.

<all> with elements 'a' and 'b' is represented as (ab|ba) -- that is, a
<choice> of every permutation of the elements. 

The problem with <all>* is that ambiguities creep in if the number of
elements is > 1 and any of the elements can have a minOccurs of 0  --
this is demonstrated by the example above. 

> Well, yes, you have to create a separate element name for each
> "Sequence of" construct. Is that so difficult?

It isn't difficult, but it gets counter-intuitive at times. I'll leave
that discussion for the ASN.1/XML lists. I thought I had found a
'cleaner' solution by using <all> for anonymous SET types, but
apparently not.
 
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 Wednesday, 27 June 2001 01:46:40 UTC