xml validation problem

Posted by Hoax on Stack Overflow See other posts from Stack Overflow or by Hoax
Published on 2010-05-30T15:13:32Z Indexed on 2010/05/30 15:22 UTC
Read the original article Hit count: 302

Filed under:

I'm having trouble validating a schema I created. "cvc-elt.1: Cannot find the declaration of element 'category'."

xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="list">
<xs:complexType>
    <xs:sequence>
        <xs:element name="category" type="categoryType" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
</xs:complexType>
</xs:element>

<xs:complexType name="categoryType">
    <xs:sequence>
        <xs:element name="name" type="xs:string"/>
        <xs:element name="desc"  type="xs:string"/>
        <xs:element name="icon" type="xs:base64Binary"/>
        <xs:element name="poi" type="poiType"  minOccurs="0"  maxOccurs="unbounded"/>
    </xs:sequence>
</xs:complexType>

<xs:complexType name="poiType">
    <xs:sequence>
        <xs:element name="name" type="xs:string"/>
        <xs:element name="desc"  type="xs:string"/>
        <xs:element name="longitude"  type="xs:long"/>
        <xs:element name="latitude"  type="xs:long"/>
        <xs:element name="url" type="xs:string" minOccurs="0"  maxOccurs="unbounded"/>
        <xs:element name="image" type="xs:base64Binary" minOccurs="0"  maxOccurs="unbounded"/>  
    </xs:sequence>
</xs:complexType>

</xs:schema>

xml

<?xml version="1.0" encoding="UTF-8"?>
<list SchemaLocation="sem.xsd">

<category>

<name>Sehenswürdigkeiten</name>
<desc>sehenswerte und berühmte Orte, die man gesehen haben muss</desc>
<icon>...</icon>

<poi>
<name>Linzer Landhaus</name>
<desc>Sitz des Oberösterreichsichen Landtags</desc>
<url>http://www.linz.at/tourismus/7569.asp</url>
<longitude>48.304107</longitude>
<latitude>14.286025</latitude>
<image>...</image>
</poi>

<poi>
<name>Ars Electronica</name>
<desc>Museum der digitalen Künste</desc>
<url>http://www.aec.at</url>
<longitude>48.309788</longitude>
<latitude>14.284179</latitude>
<image>...</image>
<image>...</image>
</poi>

</category>

<category>...</category>

</list>

any idea whats wrong? cheers hoax

© Stack Overflow or respective owner

Related posts about xml-schema