WXS: Empty element with attributes

Discussion in 'XML' started by Gustaf Liljegren, Aug 21, 2003.

  1. I ran into this example in the XML Schema Primer:

    <internationalPrice currency="EUR" value="423.46"/>

    The element is defined like this:

    <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 looks complex indeed. I wonder what the difference is between the
    above and this:

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

    Both works on the XML snippet, according to those WXS validators I've
    tried.

    Thanks,

    Gustaf
    Gustaf Liljegren, Aug 21, 2003
    #1
    1. Advertising

  2. Gustaf Liljegren <> wrote:

    > It looks complex indeed. I wonder what the difference is between the
    > above and this:


    Forget the question. It's explained in the next paragraph in the primer!
    Both are correct. I wish there was only one way to do it...

    Gustaf
    Gustaf Liljegren, Aug 21, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John

    empty/non-empty element

    John, Jul 15, 2003, in forum: XML
    Replies:
    1
    Views:
    1,009
    Klaus Johannes Rusch
    Jul 16, 2003
  2. Gustaf Liljegren

    WXS: whiteSpace

    Gustaf Liljegren, Aug 26, 2003, in forum: XML
    Replies:
    0
    Views:
    428
    Gustaf Liljegren
    Aug 26, 2003
  3. edkawas
    Replies:
    0
    Views:
    484
    edkawas
    Jun 24, 2005
  4. Replies:
    0
    Views:
    476
  5. Lukas
    Replies:
    3
    Views:
    783
    spiff
    Nov 10, 2005
Loading...

Share This Page