title: Failed to read schema file from document
body: <p>I want to unmarshal an incoming XML object with a schema. I created a schema with <code>schemagen</code> command from java object and added some minOccur and maxOccur attributes.</p>
  
  <p>I put the schema in src/main/resources. This is the error:
  <code>Failed to read schema document 'file:/C:/Users/cen/Desktop/wildfly-8.1.0.Final-sy/standalone/deployments/vloga-ear.ear/vloga-service.jar/VlogaData.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.
  </code></p>
  
  <p>Code:</p>
  
  <pre><code>SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
              ClassLoader classLoader = getClass().getClassLoader();
              File schemaFile = new File(classLoader.getResource("VlogaData.xsd").getFile());
              if (schemaFile.canRead()) LOG.info("can read");
              Schema schema = sf.newSchema(schemaFile); 
              Unmarshaller unmarshaller = context.createUnmarshaller();
              unmarshaller.setSchema(schema);
  </code></pre>
  
  <p>Schema xsd (tried with and without xml tag, with xsd namespace, same result):</p>
  
  <pre><code>&lt;xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
  
    &lt;xs:element name="VlogaData" type="VlogaData"/&gt;
  
    &lt;xs:complexType name="VlogaData"&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element minOccurs="1" maxOccurs="1" name="idVloge" type="xs:string"/&gt;
        &lt;xs:element minOccurs="1" maxOccurs="1" name="idPriloge" type="xs:string"/&gt;
        &lt;xs:element minOccurs="1" maxOccurs="1" name="imeVloge" type="xs:string"/&gt;
        &lt;xs:element minOccurs="1" maxOccurs="1" name="verzija" type="xs:string"/&gt;
        &lt;xs:element minOccurs="1" maxOccurs="1" name="vrstaPriloge" type="xs:string"/&gt;
        &lt;xs:element minOccurs="1" maxOccurs="1" name="datumOblikovanja" type="xs:string"/&gt;
        &lt;xs:element minOccurs="1" maxOccurs="1" name="datumZadnjeSpremembe" type="xs:string"/&gt;
        &lt;xs:element minOccurs="1" maxOccurs="1" name="lastnik" type="xs:string"/&gt;
        &lt;xs:element minOccurs="1" maxOccurs="1" name="kljucneBesede" type="xs:string"/&gt;
        &lt;xs:element minOccurs="1" maxOccurs="1" name="priloga" type="xs:base64Binary"/&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>How do I determine which reason of the three is it? File path seems allright (I unpacked the jar and schema is there). "can read" is not output from logger so the file can't be read.. but why? And the third reasoning should be allright too since I tried three different schemas and nothing works.</p>