OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: Empty Complex Type; Mixed Content Type

[ Lists Home | Date Index | Thread Index ]
  • From: Martin Gudgin <marting@develop.com>
  • To: xml-dev@xml.org
  • Date: Mon, 02 Oct 2000 10:49:21 +0100

This issue of whether an empty <sequence/> is needed has been resolved! It
is not needed so to define an empty element the following is fine;

  <xsd:element name="internationalPrice">
   <xsd:complexType>
    <xsd:complexContent>
      <xsd:attribute name="currency" type="xsd:string"/>
      <xsd:attribute name="value"    type="xsd:decimal"/>
    </xsd:complexContent>
   </xsd:complexType>
  </xsd:element>

Thanks very much to Henry Thompson for keeping me honest!

Regards

Martin Gudgin

----- Original Message -----
From: "Martin Gudgin" <marting@develop.com>
To: <xml-dev@xml.org>
Sent: Monday, October 02, 2000 8:34 AM
Subject: Re: Empty Complex Type; Mixed Content Type


> Yes, you are correct, the <restriction> element can be ommited because the
> anyType is being implicitly restricted.
>
> One further wrinkle that we're trying to nail down right now, you might
need
> an empty <sequence> element to show empty content;
>
>  <xsd:element name="internationalPrice">
>   <xsd:complexType>
>    <xsd:complexContent>
>      <xsd:sequence/>
>      <xsd:attribute name="currency" type="xsd:string"/>
>      <xsd:attribute name="value"    type="xsd:decimal"/>
>    </xsd:complexContent>
>   </xsd:complexType>
>  </xsd:element>
>
> the reason we can't be certain right now is that the editor of the spec is
> working through all the decisions we made with respect to the spec and
> hasn't finished chasing that one down yet. Putting in the empty sequence
> will never be wrong, but it *might* be optional, I'll keep you posted.
>
> Martin Gudgin
>
> ----- Original Message -----
> From: "Ramesh Gupta" <ramesh@eNode.com>
> To: <xml-dev@xml.org>
> Sent: Monday, October 02, 2000 5:42 AM
> Subject: Re: Empty Complex Type; Mixed Content Type
>
>
> > What you're saying makes sense, but the question then changes from "Is
> > restriction correct in this case?" to "Must restriction be explicitly
> > specified?" In other words, would the following be OK?
> >
> > <xsd:element name="internationalPrice">
> >  <xsd:complexType>
> >   <xsd:complexContent>
> >     <xsd:attribute name="currency" type="xsd:string"/>
> >     <xsd:attribute name="value"    type="xsd:decimal"/>
> >   </xsd:complexContent>
> >  </xsd:complexType>
> > </xsd:element>
> >
> > I think this should be legal too, and convey the same amount of
> information
> > as the example in the Primer, no? Restriction of xsd:anyType would be
> > implicit in such a type definition, as it is in other cases, right?
> >
> > Thanks again for clarifying.
> >
> > Ramesh
> >
> > on 10/1/00 2:26 PM, Martin Gudgin at marting@develop.com wrote:
> >
> > > After further study and converse with other WG members I must retract
my
> > > earlier assertion about the example in the XML Schema Part 0 -
Primer[1]
> > >
> > > The example in the Primer ( shown below ) is correct. An explanation
of
> why
> > > seems to be in order...
> > >
> > > <xsd:element name="internationalPrice">
> > >   <xsd:complexType>
> > >       <xsd:complexContent>
> > >           <xsd:restriction base="xsd:anyType">
> > >               <xsd:attribute name="currency" type="xsd:string"/>
> > >               <xsd:attribute name="value"    type="xsd:decimal"/>
> > >           </xsd:restriction>
> > >       </xsd:complexContent>
> > >   </xsd:complexType>
> > > </xsd:element>
> > >
> > > It might seem strange to add attributes during a restriction but
really
> it's
> > > no different from the element case:
> > >
> > > <complexType name='foo'>
> > >   <element name='bar' type='string' />
> > >   <element name='baz' type='string' />
> > > </complexType>
> > >
> > > is implicitly a restriction or the ur-type ( xsd:anyType is implicitly
> the
> > > base ).
> > >
> > > The ur-type also contains an <xsd:anyAttribute> so the similar
attribute
> > > case would be;
> > >
> > > <complexType name='foo'>
> > >   <attribute name='bar' type='string' />
> > >   <attribute name='baz' type='string' />
> > > </complexType>
> > >
> > > Here we are restricting the valid attributes from any attributes to a
> bar
> > > attribute and a baz attribute.
> >





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS