• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

unexpected child element xs:element error??

 
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
reply
    Bookmark Topic Watch Topic
  • New Topic