Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Restrictions in XML Schema

Reply
Thread Tools

Restrictions in XML Schema

 
 
Paul Johnston
Guest
Posts: n/a
 
      11-08-2006
Hi
Working my way through "Learning XML" by Erik Ray and have a question
if someone can help me.
Using Oxygen 7.2
Doing the section on XML Schema

And have a problem with the section below which raise the error:
E s4s-elt-invalid-content.1: The content of '#AnonType_age' is
invalid. Element 'restriction' is invalid, misplaced, or occurs too
often.

<xs:element name="age">
<xs:complexType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="200"/>
</xs:restriction>
</xs:complexType>
</xs:element>


It parses if I use:

<xs:element name="age">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="200"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

Am I allowed to place a restriction on a simpleType but not a
complexType as it seems ?

TIA Paul

 
Reply With Quote
 
 
 
 
jesper.tverskov@gmail.com
Guest
Posts: n/a
 
      11-20-2006
Hi Paul

A complexType means that the element has elements as content or both
elements and data and or attributes. Since you have only specified data
as content it is not a complexType but a simpleType.

Cheers,

Jesper Tverskov
www.xmltraining.biz


On Nov 8, 10:45 am, Paul Johnston <(E-Mail Removed)>
wrote:
> Hi
> Working my way through "Learning XML" by Erik Ray and have a question
> if someone can help me.
> Using Oxygen 7.2
> Doing the section on XML Schema
>
> And have a problem with the section below which raise the error:
> E s4s-elt-invalid-content.1: The content of '#AnonType_age' is
> invalid. Element 'restriction' is invalid, misplaced, or occurs too
> often.
>
> <xs:element name="age">
> <xs:complexType>
> <xs:restriction base="xs:integer">
> <xs:minInclusive value="0"/>
> <xs:maxInclusive value="200"/>
> </xs:restriction>
> </xs:complexType>
> </xs:element>
>
> It parses if I use:
>
> <xs:element name="age">
> <xs:simpleType>
> <xs:restriction base="xs:integer">
> <xs:minInclusive value="0"/>
> <xs:maxInclusive value="200"/>
> </xs:restriction>
> </xs:simpleType>
> </xs:element>
>
> Am I allowed to place a restriction on a simpleType but not a
> complexType as it seems ?
>
> TIA Paul


 
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
The following XML Schema restrictions donít make sense sqlsurfing XML 0 01-27-2010 09:03 PM
web.xml / XML schema issue, why do some XML schema attributes disappear asciz@starmail.com Java 3 02-20-2007 09:56 AM
XML Schema: How to put restrictions on element names ruediger XML 0 05-06-2006 08:51 PM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM
JAXB : expecting an automatical control in java source when restrictions are specified in XML schema Jean-Marie Condom Java 2 11-26-2004 09:19 AM



Advertisments