title: Xml Java DOM parser validation doesn't work
body: <p>I'm trying to validate an xml with DOM parser. For some reason the parser doesn't recognize the specified namespace. What could be the problem?</p>
  
  <p>It throws error:</p>
  
  <pre><code>Error: URI=null Line=5: cvc-elt.1: Cannot find the declaration of element 'ioc'.
  </code></pre>
  
  <p>The code:</p>
  
  <pre><code>String outputString = "&lt;?xml version=\"1.0\" encoding=\"us-ascii\"?&gt;\n" +
      "&lt;ioc\n" +
      "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'\n" +
      "xmlns:xsd='http://www.w3.org/2001/XMLSchema'\n" +
      "xmlns=\"http://schemas.mandiant.com/2010/ioc\" &gt;\n" +
      "&lt;/ioc&gt;";
  
  DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  factory.setValidating(true);
  factory.setNamespaceAware(true);
  factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
      "http://www.w3.org/2001/XMLSchema");
  DocumentBuilder builder = factory.newDocumentBuilder();
  builder.parse(new ByteArrayInputStream(outputString.getBytes("UTF-8")));
  </code></pre>