Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > complexType is not allowed here!?

Reply
Thread Tools

complexType is not allowed here!?

 
 
D. Alvarado
Guest
Posts: n/a
 
      04-20-2004
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
 
Reply With Quote
 
 
 
 
Victor Engmark
Guest
Posts: n/a
 
      04-21-2004
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
 
Reply With Quote
 
 
 
 
Henry S. Thompson
Guest
Posts: n/a
 
      04-21-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) (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: (E-Mail Removed)
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why defining a constant in a method is not allowed but usingself.class.const_set is allowed? IƱaki Baz Castillo Ruby 13 05-01-2011 06:09 PM
complexType/simpleType not enforced JamesG XML 2 04-21-2007 02:09 PM
simpleType/complexType not being enforced JamesG XML 0 04-19-2007 08:51 PM
XML-Schema: How can I use a complexType without a certain order of elements? Wolfgang XML 2 10-07-2003 07:50 AM
Schema: complexType restrictions Moth XML 2 08-05-2003 02:55 PM



Advertisments