javax.xml.parsers
Class DocumentBuilderFactory

java.lang.Object
  |
  +--javax.xml.parsers.DocumentBuilderFactory
Direct Known Subclasses:
HtmlDocumentBuilderFactory, LooseHtmlDocumentBuilderFactory, LooseXmlDocumentBuilderFactory, XmlDocumentBuilderFactory

public abstract class DocumentBuilderFactory
extends java.lang.Object

Responsible for creating new DOM parsers

Normally, users will create a DOM parser as follows:


 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
 DocumentBuilder parser = factory.newDocumentBuilder();
 Document doc = parser.parse(myInputSource);
 

DocumentBuilderFactory uses the system property javax.xml.parsers.XmlDocumentParserFactory to find the class to load. So you can change the parser by calling:


 System.setProperty("javax.xml.parsers.XmlDocumentParserFactory",
                    "com.foo.myFactory");
 


Constructor Summary
DocumentBuilderFactory()
           
 
Method Summary
 boolean isNamespaceAware()
          Returns whether the parser should namespace aware
 boolean isValidating()
          Returns whether the parser should namespace aware
abstract  DocumentBuilder newDocumentBuilder()
          Creates a new DocumentBuilder()
static DocumentBuilderFactory newInstance()
          Returns a new DocumentBuilderFactory instance based on the javax.xml.parsers.DocumentBuilderFactory system property.
 void setNamespaceAware(boolean aware)
          When creating a parser, create a namespace aware parser.
 void setValidating(boolean validating)
          When creating a parser, create a validating one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentBuilderFactory

public DocumentBuilderFactory()
Method Detail

newInstance

public static DocumentBuilderFactory newInstance()
Returns a new DocumentBuilderFactory instance based on the javax.xml.parsers.DocumentBuilderFactory system property.

newDocumentBuilder

public abstract DocumentBuilder newDocumentBuilder()
                                            throws ParserConfigurationException
Creates a new DocumentBuilder()

setNamespaceAware

public void setNamespaceAware(boolean aware)
When creating a parser, create a namespace aware parser.

setValidating

public void setValidating(boolean validating)
When creating a parser, create a validating one.

isNamespaceAware

public boolean isNamespaceAware()
Returns whether the parser should namespace aware

isValidating

public boolean isValidating()
Returns whether the parser should namespace aware