/** * Creates a new DocumentBuilder with the given attributes. * <p/> * * @param parseroptions * options for the new parser. * @return DocumentBuilder. */ protected static DocumentBuilder createDocumentBuilder(final DOMParserOptions parseroptions) { DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance(); DOMParserOptions options = parseroptions; if (options == null) { options = DOMParserOptions.getDefault(); } fac.setValidating(options.isValidating()); fac.setNamespaceAware(options.isNamespaceaware()); fac.setIgnoringComments(options.isIgnoreComments()); fac.setIgnoringElementContentWhitespace(options.isIgnoreElementContentWhitespace()); fac.setXIncludeAware(options.isXincludeAware()); fac.setCoalescing(options.isCoalescing()); fac.setExpandEntityReferences(options.isExpandEntityReferences()); fac.setSchema(options.getSchema()); try { return fac.newDocumentBuilder(); } catch (ParserConfigurationException e) { throw new RuntimeException(e); } }