Code example for DocumentBuilderFactory

Methods: setAttributesetNamespaceAwaresetValidating

0
  Map schemas;
  TestEntityResolver testEntityResolver;
   
  protected void setUp() throws Exception { 
    dbf = DocumentBuilderFactory.newInstance();
    dbf.setValidating(true);
    dbf.setNamespaceAware(true);
    dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
                     "http://www.w3.org/2001/XMLSchema"); 
 
    schemas = new HashMap();
    testEntityResolver = new TestEntityResolver(schemas);
  } 
 
  public void addSchema(String schemaXmlString) {
    String systemId = "urn:schema"+schemas.size(); 
    schemas.put(systemId, schemaXmlString);
     
    String[] schemaSources = new String[schemas.size()];
    for (int i=0; i<schemas.size(); i++) {
Experience pair programming with AI  Get Codota for Java