title: XSD Validation Error in JAVA
body: <p>I'm trying to validate my XML files from given XSD file with the following code, </p>
  
  <pre><code>        Source xmlFile = new StreamSource(fXmlFile);
          SchemaFactory schemaFactory = SchemaFactory
          .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
          Schema schema = schemaFactory.newSchema(new File("presentation.xsd"));
          Validator validator = schema.newValidator();
          try {
              validator.validate(xmlFile);
              System.out.println(xmlFile.getSystemId() + " is valid");
          } catch (SAXException e) {
              System.out.println(xmlFile.getSystemId() + " is NOT valid");
              System.out.println("Reason: " + e.getLocalizedMessage());
          }
  </code></pre>
  
  <p>And I uploaded my XSD file to here to show you: <a href="http://orhancanceylan.com/stack/presentation.xsd" rel="nofollow">http://orhancanceylan.com/stack/presentation.xsd</a></p>
  
  <p>But when I run my code, I get this error:</p>
  
  <pre><code>org.xml.sax.SAXParseException: s4s-att-not-allowed: Attribute 'maxOccurs' cannot appear in element 'element'.
  </code></pre>
  
  <p>What's the problem, how should I solve it ?</p>