Java XML Document Create createDocumentBuilder(boolean namespaces, boolean validating)

Here you can find the source of createDocumentBuilder(boolean namespaces, boolean validating)

Description

create Document Builder

License

BSD License

Declaration

private static DocumentBuilder createDocumentBuilder(boolean namespaces, boolean validating)
            throws ParserConfigurationException 

Method Source Code

//package com.java2s;
/*// w  w w  .j  a  va 2  s  .c om
 * Copyright (c) 2012. betterFORM Project - http://www.betterform.de
 * Licensed under the terms of BSD License
 */

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

public class Main {
    private static DocumentBuilder createDocumentBuilder(boolean namespaces, boolean validating)
            throws ParserConfigurationException {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setNamespaceAware(namespaces);
        factory.setValidating(validating);

        //        factory.setAttribute("http://xml.org/sax/features/namespace-prefixes)",new Boolean(true));
        DocumentBuilder builder = factory.newDocumentBuilder();

        return builder;
    }
}

Related

  1. createDocument(String rootNodeName)
  2. createDocument(String rootQName, String namespaceURI, String doctypePublicID, String doctypeSystemID)
  3. createDocument(String str)
  4. createDocument(String xml)
  5. createDocumentBuilder()
  6. createDocumentBuilderFactory()
  7. createDocumentBuilderFactory(ClassLoader classLoader)
  8. createDocumentFromElement(final Element element)
  9. createDocumentFromFile(File file)