Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unexpected child element xs:element error??

 
john mattucci
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
janise
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic