javax.xml.parsers
Class DocumentBuilderFactory

java.lang.Object
  |
  +--javax.xml.parsers.DocumentBuilderFactory

public abstract class DocumentBuilderFactory
extends java.lang.Object

Defines a factory API that enables applications to obtain a parser that produces DOM object trees from XML documents.

Since:
JAXP 1.0

Constructor Summary
protected DocumentBuilderFactory()
           
 
Method Summary
 boolean isNamespaceAware()
          Indicates whether or not the factory is configured to produce parsers which are namespace aware.
 boolean isValidating()
          Indicates whether or not the factory is configured to produce parsers which validate the XML content during parse.
abstract  DocumentBuilder newDocumentBuilder()
          Creates a new instance of a DocumentBuilder using the currently configured parameters.
static DocumentBuilderFactory newInstance()
          Obtain a new instance of a DocumentBuilderFactory.
 void setNamespaceAware(boolean awareness)
          Specifies that the parser produced by this code will provide support for XML namespaces.
 void setValidating(boolean validating)
          Specifies that the parser produced by this code will validate documents as they are parsed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentBuilderFactory

protected DocumentBuilderFactory()
Method Detail

newInstance

public static DocumentBuilderFactory newInstance()
Obtain a new instance of a DocumentBuilderFactory. This static method creates a new factory instance based on a System property setting or uses the platform default if no property has been defined.

The system property that controls which Factory implementation to create is named "javax.xml.parsers.DocumentBuilderFactory". This property names a class that is a concrete subclass of this abstract class. If no property is defined, a platform default will be used.

Once an application has obtained a reference to a DocumentBuilderFactory it can use the factory to configure and obtain parser instances.

Throws:
FactoryConfigurationError - if the implementation is not available or cannot be instantiated.

newDocumentBuilder

public abstract DocumentBuilder newDocumentBuilder()
                                            throws ParserConfigurationException
Creates a new instance of a DocumentBuilder using the currently configured parameters.
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration requested

setNamespaceAware

public void setNamespaceAware(boolean awareness)
Specifies that the parser produced by this code will provide support for XML namespaces.

setValidating

public void setValidating(boolean validating)
Specifies that the parser produced by this code will validate documents as they are parsed.

isNamespaceAware

public boolean isNamespaceAware()
Indicates whether or not the factory is configured to produce parsers which are namespace aware.

isValidating

public boolean isValidating()
Indicates whether or not the factory is configured to produce parsers which validate the XML content during parse.


Submit Feedback to xml-feedback@java.sun.com
Copyright © 1998-2000 Sun Microsystems, Inc. All Rights Reserved.

Sun Microsystems, Inc.
901 San Antonio Road
Palo Alto, California, 94303, U.S.A.