aspose file tools*
The moose likes XML and Related Technologies and the fly likes unexpected child element xs:element error?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "unexpected child element xs:element error??" Watch "unexpected child element xs:element error??" New topic
Author

unexpected child element xs:element error??

john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
Im getting a unexpected child element xs:element error at ****
Im quite new to schemas. Thank you all for your time.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.datastay.com/schema"
xmlns:target="http://www.datastay.com/schema"
elementFormDefault="qualified">

<xs:element name="time" type="xs:int" default="1"/>
<xs:element name="timeType">
<xs:simpleType>
<xs:restriction base="xs:string" default="weeks">
<xs:enumeration value="minutes"/>
<xs:enumeration value="hours"/>
<xs:enumeration value="days"/>
<xs:enumeration value="weeks"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:complexType name="refresh">
<xs:all>
<xs:element ref="target:time"/>
<xs:element ref="target:timeType"/>
</xs:all>
</xs:complexType>

<xs:complexType name="query">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="series" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="chartDefinition">
<xs:all>
<xs:element ref="target:refresh"/>
<xs:element ref="target:query"/>
</xs:all>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="title" type="xs:string" use="required"/>
<xs:attribute name="type" type="xs:string" use="required"/>
<xs:attribute name="xaxislabel" type="xs:string" use="required"/>
<xs:attribute name="yaxislabel" type="xs:string" use="required"/>
<xs:attribute name="classType" default="com.dms.chart.DefaultChartBusinessHandler">
<xs:simpleType>
<xs:restriction base="xs:string" >
<xs:enumeration value="com.dms.chart.DefaultChartBusinessHandler"/>
<xs:enumeration value="com.dms.chart.PieChartBusinessHandler"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="width" type="xs:int" default="500"/>
<xs:attribute name="height" type="xs:int" default="500"/>
<xs:attribute name="chartColor" type="xs:string" default="#FFFFFF"/>
</xs:complexType>

<xs:element name="charts">
<xs:complexType>
**** <xs:element ref="target:chartDefinition" maxOccurs="unbounded"/>
</xs:complexType>
</xs:element>
</xs:schema>
clio katz
Ranch Hand

Joined: Apr 30, 2004
Posts: 101
john,

The schema has validation errors.

my validating schema parser emits




soooo

not sure why there are asterisks in line 58:

**** <xs:element ref="target:chartDefinition" maxOccurs="unbounded"/>


the other errors you can trace out by the ":line:col:" notations and the error titles above. write back if you run into trouble!


hth
Tom Passin
author
Ranch Hand

Joined: Aug 08, 2004
Posts: 30
You are not allowed to have an xs:element there. You are supposed to have a sequence, choice, etc., that would contain the element (even if there is only one, it can still be a sequence or choice).


Author of <a href="http://www.amazon.com/exec/obidos/ASIN/1932394206/ref=jranch-20" target="_blank" rel="nofollow">Explorer's Guide to the Semantic Web</a>
janise
Greenhorn

Joined: Aug 28, 2004
Posts: 1
Hello!

I have this schema and it gives me the same error...



Can anyone, please, tell what's wrong with it?

Thanks,
Janis
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Hello Janis,

May I ask you to add a last name into your display name so that it complies with our naming policy?

Thanks, and welcome to the 'ranch!


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unexpected child element xs:element error??