complexType is not allowed here!?

Discussion in 'XML' started by D. Alvarado, Apr 20, 2004.

  1. D. Alvarado

    D. Alvarado Guest

    Hello,
    I am trying to validate my XML document against a schema using the
    Sun Multi-Schema XML Validator. Unfortunately, my schema fails to
    validate, and is failing because of this cryptic message:

    element "xs:complexType" is not allowed here

    which is complaining about the second line of this declaration
    <xs:element name="ISBN" type="xs:string">
    <xs:complexType>
    <xs:attribute name="pub_status">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:enumeration value="NYP"/>
    </xs:restriction>
    </xs:simpleType> </xs:attribute>
    </xs:complexType>
    </xs:element>

    Does anyone have any advice? I would like the following XML to
    validate:

    <ISBN pub_status="NYP">0030518293</ISBN>

    Thanks, - Dave
     
    D. Alvarado, Apr 20, 2004
    #1
    1. Advertising

  2. D. Alvarado wrote:
    > Hello,
    > I am trying to validate my XML document against a schema using the
    > Sun Multi-Schema XML Validator. Unfortunately, my schema fails to
    > validate, and is failing because of this cryptic message:
    >
    > element "xs:complexType" is not allowed here
    >
    > which is complaining about the second line of this declaration
    > <xs:element name="ISBN" type="xs:string">
    > <xs:complexType>
    > <xs:attribute name="pub_status">
    > <xs:simpleType>
    > <xs:restriction base="xs:string">
    > <xs:enumeration value="NYP"/>
    > </xs:restriction>
    > </xs:simpleType> </xs:attribute>
    > </xs:complexType>
    > </xs:element>
    >
    > Does anyone have any advice? I would like the following XML to
    > validate:
    >
    > <ISBN pub_status="NYP">0030518293</ISBN>


    The root of the problem is that an element of type string cannot contain
    a complex element. Also, the attribute element is not closed. Check out
    http://www.w3schools.com/schema/schema_complex_text.asp for a good
    explanation and example.

    --
    Victor
     
    Victor Engmark, Apr 21, 2004
    #2
    1. Advertising

  3. (D. Alvarado) writes:

    > [schema] failing because of this cryptic message:
    >
    > element "xs:complexType" is not allowed here
    >
    > which is complaining about the second line of this declaration
    >
    > <xs:element name="ISBN" type="xs:string">
    > <xs:complexType>


    xs:element can _either_ name a type definition _or_ embed one but not
    both.

    ht
    --
    Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
    Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
    Fax: (44) 131 650-4587, e-mail:
    URL: http://www.ltg.ed.ac.uk/~ht/
    [mail really from me _always_ has this .sig -- mail without it is forged spam]
     
    Henry S. Thompson, Apr 21, 2004
    #3
    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. Joshua Beall

    Character data not allowed here? What?

    Joshua Beall, May 1, 2004, in forum: HTML
    Replies:
    19
    Views:
    16,062
    Mark Parnell
    May 3, 2004
  2. mike
    Replies:
    1
    Views:
    455
    Jukka K. Korpela
    May 2, 2004
  3. JamesG
    Replies:
    0
    Views:
    362
    JamesG
    Apr 19, 2007
  4. JamesG
    Replies:
    2
    Views:
    396
    JamesG
    Apr 21, 2007
  5. Iñaki Baz Castillo
    Replies:
    13
    Views:
    505
    Iñaki Baz Castillo
    May 1, 2011
Loading...

Share This Page