complexType is not allowed here!?

D

D. Alvarado

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
 
V

Victor Engmark

D. Alvarado said:
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.
 
H

Henry S. Thompson

[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: (e-mail address removed)
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top