468,512 Members | 1,457 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

cvc-elt.1: Cannot find the declaration of element 'student'.What to do?

2
My xml document

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <student xmlns="hyperjam@mail/ru">
  3. <uek:copyright xmlns:uek="http://uek.krakow.pl/">Wydział Zarządzania, Uniwersytet Ekonomiczny, Krakуw</uek:copyright>
  4.  <name gender="female">Anna</name>
  5.  <surname>Postevka</surname>
  6.  <age>18</age>
  7.  <group faculty="applied informatic">KrDZIa1013</group>
  8.  <country_of_origin>Ukraine</country_of_origin>
  9.  <city>Rivne</city>
  10.  <semester>1</semester>
  11.  <listitem_books>
  12.   <!-- This list of items describe the collection of fantasy,horror and fiction books, which where published in 2012. I choose this genres, because I like them the most and i wanted you to know,what's new in the world of this kind of books -->
  13.    <book>
  14.      <title genre="fiction">The White Forest</title>
  15.      <original_title>Empyrean</original_title>
  16.      <author gender="male">Adam McOmber</author>
  17.      <year_of_publishing>2012</year_of_publishing>
  18.      <paper quality="matte"></paper>
  19.     </book>
  20.     <book>
  21.      <title genre="fiction">Dodger</title>
  22.      <original_title>The Dodger</original_title>
  23.      <author gender="female">Terry Pratchett</author>
  24.      <year_of_publishing>2012</year_of_publishing>
  25.      <paper quality="glossy"></paper>
  26.     </book>
  27.     <book>
  28.      <title genre="horror">Ten</title>
  29.      <original_title>Ten</original_title>
  30.      <author gender="female">Gretchen McNeil</author>
  31.      <year_of_publishing>2012</year_of_publishing>
  32.      <paper quality="matte"></paper>
  33.     </book>
  34.     <book>
  35.      <title genre="fiction">Let the Right One In</title>
  36.      <original_title>Lat den ratte komma in</original_title>
  37.      <author gender="male">John Ajvide Lindqvist</author>
  38.      <year_of_publishing>2012</year_of_publishing>
  39.      <paper quality="matte"></paper>
  40.     </book>
  41.     <book>
  42.      <title genre="fantasy">The Graveyard Book</title>
  43.      <original_title>The Graveyard Book</original_title>
  44.      <author gender="male">Neil Gaiman</author>
  45.      <year_of_publishing>2012</year_of_publishing>
  46.      <paper quality="glossy"></paper>
  47.     </book>
  48.     <book>
  49.      <title genre="fantasy">Cursed</title>
  50.      <original_title>Cursed</original_title>
  51.      <author gender="female">Jennifer L. Armentrout</author>
  52.      <year_of_publishing>2012</year_of_publishing>
  53.      <paper quality="matte"></paper>
  54.     </book>
  55.     <book>
  56.      <title genre="horror">The Necro Device</title>
  57.      <original_title>Mandiev</original_title>
  58.      <author gender="male">M.T. Dismuke</author>
  59.      <year_of_publishing>2012</year_of_publishing>
  60.      <paper quality="matte"></paper>
  61.     </book>
  62.     <book>
  63.      <title genre="horror">The Hallowed Ones</title>
  64.      <original_title>The Hallowed Ones</original_title>
  65.      <author gender="female">Laura Bickle</author>
  66.      <year_of_publishing>2012</year_of_publishing>
  67.      <paper quality="glossy"></paper>
  68.     </book>
  69.     <book>
  70.      <title genre="horror">Blackwood</title>
  71.      <original_title>Blackwood</original_title>
  72.      <author gender="female">Gwenda Bond</author>
  73.      <year_of_publishing>2012</year_of_publishing>
  74.      <paper quality="glossy"></paper>
  75.     </book>
  76.     <book>
  77.      <title genre="horror">Incarnation</title>
  78.      <original_title>Incarnation</original_title>
  79.      <author gender="female">Emma Cornwall</author>
  80.      <year_of_publishing>2012</year_of_publishing>
  81.      <paper quality="matte"></paper>
  82.     </book>
  83.   </listitem_books>
  84. </student>
and here is my schema

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ru="hyperjam@mail/ru" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  3.  
  4.  
  5.  <xsd:element name="student" type="StudentType"/>
  6.   <xsd:complexType name="StudentType"> 
  7.    <xsd:sequence>
  8.     <xsd:element name="name">
  9.      <xsd:complexType>
  10.       <xsd:attribute name="gender" use="required">
  11.        <xsd:simpleType>
  12.         <xsd:restriction base="xsd:string">
  13.          <xsd:pattern value="male|female"/>
  14.         </xsd:restriction>     
  15.        </xsd:simpleType>
  16.       </xsd:attribute>  
  17.      </xsd:complexType>
  18.     </xsd:element>
  19.     <xsd:element name="surname" type="xsd:string" />
  20.     <xsd:element name="age" type="xsd:integer" />
  21.     <xsd:element name="group">
  22.      <xsd:complexType>
  23.       <xsd:attribute name="faculty" type="xsd:string" use="required"/>
  24.      </xsd:complexType>
  25.     </xsd:element>
  26.     <xsd:element name="country_of_origin" type="xsd:string" />
  27.     <xsd:element name="city" type="xsd:string" />
  28.     <xsd:element name="semester" type="xsd:integer" />
  29.     <xsd:element name="listitem_books">
  30.      <xsd:complexType>
  31.       <xsd:sequence>
  32.        <xsd:element name="book" minOccurs ="10" maxOccurs="unbounded">
  33.           <xsd:complexType>
  34.             <xsd:sequence>
  35.               <xsd:element name="title">
  36.                <xsd:complexType>
  37.                  <xsd:simpleContent>
  38.                   <xsd:extension base="xsd:string">
  39.                    <xsd:attribute name="genre" use="required">
  40.                     <xsd:simpleType>
  41.                      <xsd:restriction base="xsd:string">
  42.                       <xsd:enumeration value="fantasy"/>
  43.                       <xsd:enumeration value="horror"/>
  44.                       <xsd:enumeration value="fiction"/>
  45.                     </xsd:restriction>
  46.                    </xsd:simpleType>
  47.                   </xsd:attribute>
  48.                  </xsd:extension>
  49.                 </xsd:simpleContent>
  50.                </xsd:complexType>
  51.               </xsd:element>
  52.               <xsd:element name="original_title" type="xsd:string" />
  53.               <xsd:element name="author">
  54.                <xsd:complexType>
  55.                  <xsd:simpleContent>
  56.                   <xsd:extension base="xsd:string">
  57.                    <xsd:attribute type="xsd:string" name="gender" use="required"/>
  58.                  </xsd:extension>
  59.                 </xsd:simpleContent>
  60.                </xsd:complexType>
  61.               </xsd:element>
  62.               <xsd:element name="year_of_publishing" type="xsd:integer" />
  63.               <xsd:element name="paper">
  64.                <xsd:complexType>
  65.                 <xsd:simpleContent>
  66.                  <xsd:extension base="xsd:string">
  67.                   <xsd:attribute name="quality" use="required">
  68.                    <xsd:simpleType>
  69.                     <xsd:restriction base="xsd:string">
  70.                      <xsd:enumeration value="glossy"/>
  71.                      <xsd:enumeration value="matte"/>
  72.                     </xsd:restriction>
  73.                    </xsd:simpleType>
  74.                   </xsd:attribute>
  75.                  </xsd:extension>
  76.                 </xsd:simpleContent>
  77.                </xsd:complexType>
  78.               </xsd:element>
  79.             </xsd:sequence>
  80.           </xsd:complexType>
  81.        </xsd:element>
  82.       </xsd:sequence>
  83.      </xsd:complexType>
  84.     </xsd:element>
  85.    </xsd:sequence>
  86.   </xsd:complexType> 
  87. </xsd:schema>
the validator says

Not valid.
Error - Line 2, 35: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 35; cvc-elt.1: Cannot find the declaration of element 'student'.
Nov 4 '12 #1
0 2090

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by anguo | last post: by
3 posts views Thread by dfielder | last post: by
8 posts views Thread by Dennis Gearon | last post: by
6 posts views Thread by Tim Edwards | last post: by
3 posts views Thread by Josh Armstrong | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.