Question about XML-Schema choice structure.

Discussion in 'XML' started by GB, Sep 16, 2003.

  1. GB

    GB Guest

    If I define the following schema which allows either a tag element OR
    an tag and origin_system elements I get an error. Same thing happens
    when I use groups. Is this because tag is defined twice? My reading of
    the XML-Schema spec seems to suggest that the schema is valid & that
    Xerces is in error.

    I get the error with Java Xerces 2.3.0 but not with C++ Xerces 1.7.0.

    Can anyone explain?

    Here's the error...

    error [4,16] cvc-complex-type.2.4.a: Invalid content starting with
    element 'origin_system'. The content must match

    Here's the schema....

    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="">

    <xsd:element name="fx" type="fx_type"/>

    <xsd:complexType name="fx_type">
    <xsd:element name="tag" type="xsd:string" minOccurs="1"
    <xsd:element name="tag" type="xsd:string" minOccurs="1"
    <xsd:element name="origin_system" type="xsd:string"
    minOccurs="1" maxOccurs="1"/>


    Heres the XML...

    <?xml version="1.0" encoding="UTF-8"?>
    GB, Sep 16, 2003
    1. Advertisements

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.

Share This Page