javax.xml.parsers
public abstract class DocumentBuilderFactory extends Object
DocumentBuilderFactory
class is
NOT guaranteed to be thread safe. It is up to the user application
to make sure about the use of the DocumentBuilderFactory
from
more than one thread. Alternatively the application can have one instance
of the DocumentBuilderFactory
per thread.
An application can use the same instance of the factory to obtain one or
more instances of the DocumentBuilder
provided the instance
of the factory isn't being used in more than one thread at a time.
Since: JAXP 1.0
Version: 1.0
Constructor Summary | |
---|---|
protected | DocumentBuilderFactory() |
Method Summary | |
---|---|
abstract Object | getAttribute(String name)
Allows the user to retrieve specific attributes on the underlying
implementation. |
boolean | isCoalescing()
Indicates whether or not the factory is configured to produce
parsers which converts CDATA nodes to Text nodes and appends it to
the adjacent (if any) Text node.
|
boolean | isExpandEntityReferences()
Indicates whether or not the factory is configured to produce
parsers which expand entity reference nodes.
|
boolean | isIgnoringComments()
Indicates whether or not the factory is configured to produce
parsers which ignores comments.
|
boolean | isIgnoringElementContentWhitespace()
Indicates whether or not the factory is configured to produce
parsers which ignore ignorable whitespace in element content.
|
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 {@link javax.xml.parsers.DocumentBuilder}
using the currently configured parameters.
|
static DocumentBuilderFactory | newInstance()
Obtain a new instance of a
DocumentBuilderFactory . |
abstract void | setAttribute(String name, Object value)
Allows the user to set specific attributes on the underlying
implementation. |
void | setCoalescing(boolean coalescing)
Specifies that the parser produced by this code will
convert CDATA nodes to Text nodes and append it to the
adjacent (if any) text node. |
void | setExpandEntityReferences(boolean expandEntityRef)
Specifies that the parser produced by this code will
expand entity reference nodes. |
void | setIgnoringComments(boolean ignoreComments)
Specifies that the parser produced by this code will
ignore comments. |
void | setIgnoringElementContentWhitespace(boolean whitespace)
Specifies that the parsers created by this factory must eliminate
whitespace in element content (sometimes known loosely as
'ignorable whitespace') when parsing XML documents (see XML Rec
2.10). |
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. |
Parameters: name The name of the attribute.
Returns: value The value of the attribute.
Throws: IllegalArgumentException thrown if the underlying implementation doesn't recognize the attribute.
Returns: true if the factory is configured to produce parsers which converts CDATA nodes to Text nodes and appends it to the adjacent (if any) Text node; false otherwise.
Returns: true if the factory is configured to produce parsers which expand entity reference nodes; false otherwise.
Returns: true if the factory is configured to produce parsers which ignores comments; false otherwise.
Returns: true if the factory is configured to produce parsers which ignore ignorable whitespace in element content; false otherwise.
Returns: true if the factory is configured to produce parsers which are namespace aware; false otherwise.
Returns: true if the factory is configured to produce parsers which validate the XML content during parse; false otherwise.
Returns: A new instance of a DocumentBuilder.
Throws: ParserConfigurationException if a DocumentBuilder cannot be created which satisfies the configuration requested.
DocumentBuilderFactory
. This static method creates
a new factory instance.
This method uses the following ordered lookup procedure to determine
the DocumentBuilderFactory
implementation class to
load:
javax.xml.parsers.DocumentBuilderFactory
system
property.
java.util.Properties
format and contains the fully qualified name of the
implementation class with the key being the system property defined
above.
META-INF/services/javax.xml.parsers.DocumentBuilderFactory
in jars available to the runtime.
DocumentBuilderFactory
instance.
DocumentBuilderFactory
it can use the factory to
configure and obtain parser instances.
Throws: FactoryConfigurationError if the implementation is not available or cannot be instantiated.
Parameters: name The name of the attribute. value The value of the attribute.
Throws: IllegalArgumentException thrown if the underlying implementation doesn't recognize the attribute.
false
Parameters: coalescing true if the parser produced will convert CDATA nodes to Text nodes and append it to the adjacent (if any) text node; false otherwise.
true
Parameters: expandEntityRef true if the parser produced will expand entity reference nodes; false otherwise.
false
false
.
Parameters: whitespace true if the parser created must eliminate whitespace in the element content when parsing XML documents; false otherwise.
false
Parameters: awareness true if the parser produced will provide support for XML namespaces; false otherwise.
false
.
Parameters: validating true if the parser produced will validate documents as they are parsed; false otherwise.