title: Validating xml against an xsd which has an include
body: <p>I'm trying to validate an XML against an XSD which internally refers to another XSD (using include statement).</p>
  
  <p>as,</p>
  
  <pre><code>&lt;xs:include schemaLocation="Schema2.xsd"/&gt;
  </code></pre>
  
  <p>Now while validating my XML against the xsd(schema1.xsd) like:</p>
  
  <pre><code>DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  
      DocumentBuilder builder;
      try {
          builder = factory.newDocumentBuilder();
  
          Document document = builder.parse(new InputSource(new StringReader(
                  inputXml)));
          TransformerFactory tranFactory = TransformerFactory.newInstance();
          Transformer aTransformer = tranFactory.newTransformer();
          Source src = new DOMSource(document);
          Result xmlFile = new StreamResult(new File("xmlFileName.xml"));
          aTransformer.transform(src, xmlFile);
      } catch (Exception e) {
          // TODO: handle exception
      }
  
      File xmlFile = new File("xmlFileName.xml");
      SchemaFactory factory1 = SchemaFactory
              .newInstance("http://www.w3.org/2001/XMLSchema");
  
      File schemaLocation = new File("F:\\Project\\Automation\\XSDs\\schema1.xsd");
      Schema schema = factory1.newSchema(schemaLocation);
  
      Validator validator = schema.newValidator();
  
      Source source = new StreamSource(xmlFile);
  
      try {
          validator.validate(source);
          System.out.println(xmlFile.getName() + " is valid.");
          isXmlValid = true;
      } catch (SAXException ex) {
          System.out.println(xmlFile.getName() + " is not valid because ");
          System.out.println(ex.getMessage());
          isXmlValid = false;
      }
  </code></pre>
  
  <p>I get an error, "cvc-datatype-valid.1.2.1: 'True' is not a valid value for 'boolean'."</p>
  
  <p>This is for an element which is defined in the schema2.xsd which schema1.xsd is referring.</p>
  
  <p>Please tell me if I am doing something wrong.</p>