title: xml validation against XSD: Invalid content was found starting with element xxx
body: <p>My xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;workbook xmlns="http://www.dei.isep.ipp.pt/lapr4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dei.isep.ipp.pt/lapr4 validate.xsd"&gt;
  &lt;lastSave&gt;2013/06/05 20:33:23&lt;/lastSave&gt;
  &lt;numSpreadsheets&gt;3&lt;/numSpreadsheets&gt;
  &lt;spreadsheet title="Sheet  1"&gt;
  &lt;cell horizAlign="2" vertiAlign="0" fontStyle="0" fontSize="12" fontName="Dialog" fgColor="-13421773" bgColor="-1" left="1" right="1" top="1" bottom="1" content="a" address="C7" row="6" column="2"/&gt;
  &lt;cell horizAlign="2" vertiAlign="0" fontStyle="0" fontSize="12" fontName="Dialog" fgColor="-13421773" bgColor="-1" left="1" right="1" top="1" bottom="1" content="asd" address="A7" row="6" column="0"/&gt;
  &lt;cell horizAlign="2" vertiAlign="0" fontStyle="0" fontSize="12" fontName="Dialog" fgColor="-13421773" bgColor="-1" left="1" right="1" top="1" bottom="1" content="ad" address="B5" row="4" column="1"/&gt;
  &lt;cell horizAlign="2" vertiAlign="0" fontStyle="0" fontSize="12" fontName="Dialog" fgColor="-13421773" bgColor="-1" left="1" right="1" top="1" bottom="1" content="sad" address="B7" row="6" column="1"/&gt;
  &lt;/spreadsheet&gt;
  &lt;spreadsheet title="Sheet  2"/&gt;
  &lt;spreadsheet title="Sheet  3"/&gt;
  &lt;/workbook&gt;
  </code></pre>
  
  <p>My xsd file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;xs:schema xmlns="http://www.dei.isep.ipp.pt/lapr4" 
             xmlns:xs="http://www.w3.org/2001/XMLSchema"
             targetNamespace="http://www.dei.isep.ipp.pt/lapr4"
             elementFormDefault="qualified"&gt;
  
      &lt;xs:element name="workbook" type="TWorkbook"/&gt;
  
  &lt;/xs:schema&gt;
  &lt;xs:complexType name="TWorkbook"&gt;
      &lt;xs:sequence&gt;
          &lt;xs:element name="lastSave" type="xs:string"/&gt;
          &lt;xs:element name="numSpreadsheets" type="TnumSpreadsheets" minOccurs="1"/&gt;
          &lt;xs:element name="spreadsheet" type="TSpreadSheet" maxOccurs="unbounded"/&gt;
      &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:simpleType name="TnumSpreadsheets"&gt;
      &lt;xs:restriction base="xs:int"&gt;
          &lt;xs:minInclusive value="0"/&gt;
          &lt;xs:maxInclusive value="100" /&gt;
      &lt;/xs:restriction&gt;
  &lt;/xs:simpleType&gt;
  
  &lt;xs:complexType name="TSpreadSheet"&gt;
      &lt;xs:sequence&gt;
          &lt;xs:element name="cell" type="TCell"  maxOccurs="unbounded"/&gt;
      &lt;/xs:sequence&gt;
      &lt;xs:attribute name="title" type="xs:string" /&gt; 
  &lt;/xs:complexType&gt;    
  
  &lt;xs:complexType name="TCell"&gt;
      &lt;xs:attribute name="row" type="xs:int" /&gt;
      &lt;xs:attribute  name="column" type="xs:int" /&gt;
  
      &lt;xs:attribute  name="horizAlign" type="xs:int" /&gt;
      &lt;xs:attribute  name="vertiAlign" type="xs:int" /&gt;
  
      &lt;xs:attribute  name="fontStyle" type="xs:int" /&gt;
      &lt;xs:attribute  name="fontSize" type="xs:int" /&gt;
      &lt;xs:attribute  name="font" type="xs:string" /&gt;
      &lt;xs:attribute  name="address" type="xs:string" /&gt;
      &lt;xs:attribute  name="fontName" type="xs:string" /&gt;
      &lt;xs:attribute  name="fgColor" type="xs:int" /&gt;
      &lt;xs:attribute  name="bgColor" type="xs:int" /&gt;
  
      &lt;xs:attribute  name="left" type="xs:int" /&gt;
      &lt;xs:attribute  name="right" type="xs:int" /&gt;
      &lt;xs:attribute  name="top" type="xs:int" /&gt;
      &lt;xs:attribute  name="bottom" type="xs:int" /&gt;
  
      &lt;xs:attribute  name="content" type="xs:string" /&gt;
  &lt;/xs:complexType&gt;      
  
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>I verified the file one by one, and against each other on the web and on NetBeans but when I run the application I always get this error:</p>
  
  <blockquote>
    <p>org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content
    was found starting with element 'lastSave'. One of
    '{"<a href="http://www.dei.isep.ipp.pt/lapr4" rel="nofollow">http://www.dei.isep.ipp.pt/lapr4</a>":numSpreadsheets}' is expected.</p>
  </blockquote>
  
  <p>I've been searching all over for an answer for this but nothing seems to be working, can someone give me some lights on the problem?</p>
  
  <p>Thanks in advance.</p>