public class DocumentBuilderFactoryImpl
extends javax.xml.parsers.DocumentBuilderFactory
Constructor and Description |
---|
DocumentBuilderFactoryImpl() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getAttribute(java.lang.String name)
Allows the user to retrieve specific attributes on the underlying
implementation.
|
boolean |
getFeature(java.lang.String name)
Get the state of the named feature.
|
javax.xml.validation.Schema |
getSchema()
Gets the
Schema object specified through
the DocumentBuilderFactory.setSchema(Schema schema) method. |
boolean |
isXIncludeAware()
Get state of XInclude processing.
|
javax.xml.parsers.DocumentBuilder |
newDocumentBuilder()
Creates a new instance of a
DocumentBuilder
using the currently configured parameters. |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Allows the user to set specific attributes on the underlying
implementation.
|
void |
setFeature(java.lang.String name,
boolean value)
Set a feature for this
DocumentBuilderFactory and DocumentBuilder s created by this factory. |
void |
setSchema(javax.xml.validation.Schema grammar)
Set the
Schema to be used by parsers created
from this factory. |
void |
setXIncludeAware(boolean state)
Set state of XInclude processing.
|
isCoalescing, isExpandEntityReferences, isIgnoringComments, isIgnoringElementContentWhitespace, isNamespaceAware, isValidating, newInstance, newInstance, setCoalescing, setExpandEntityReferences, setIgnoringComments, setIgnoringElementContentWhitespace, setNamespaceAware, setValidating
public javax.xml.parsers.DocumentBuilder newDocumentBuilder() throws javax.xml.parsers.ParserConfigurationException
DocumentBuilder
using the currently configured parameters.newDocumentBuilder
in class javax.xml.parsers.DocumentBuilderFactory
javax.xml.parsers.ParserConfigurationException
- if a DocumentBuilder
cannot be created which satisfies the configuration requested.public void setAttribute(java.lang.String name, java.lang.Object value) throws java.lang.IllegalArgumentException
setAttribute
in class javax.xml.parsers.DocumentBuilderFactory
name
- name of attributevalue
- null means to remove attributejava.lang.IllegalArgumentException
- thrown if the underlying
implementation doesn't recognize the attribute.public java.lang.Object getAttribute(java.lang.String name) throws java.lang.IllegalArgumentException
getAttribute
in class javax.xml.parsers.DocumentBuilderFactory
name
- The name of the attribute.java.lang.IllegalArgumentException
- thrown if the underlying
implementation doesn't recognize the attribute.public javax.xml.validation.Schema getSchema()
javax.xml.parsers.DocumentBuilderFactory
Schema
object specified through
the DocumentBuilderFactory.setSchema(Schema schema)
method.getSchema
in class javax.xml.parsers.DocumentBuilderFactory
Schema
object that was last set through
the DocumentBuilderFactory.setSchema(Schema)
method, or null
if the method was not invoked since a DocumentBuilderFactory
is created.public void setSchema(javax.xml.validation.Schema grammar)
javax.xml.parsers.DocumentBuilderFactory
Set the Schema
to be used by parsers created
from this factory.
When a Schema
is non-null, a parser will use a validator
created from it to validate documents before it passes information
down to the application.
When errors are found by the validator, the parser is responsible
to report them to the user-specified ErrorHandler
(or if the error handler is not set, ignore them or throw them), just
like any other errors found by the parser itself.
In other words, if the user-specified ErrorHandler
is set, it must receive those errors, and if not, they must be
treated according to the implementation specific
default error handling rules.
A validator may modify the outcome of a parse (for example by adding default values that were missing in documents), and a parser is responsible to make sure that the application will receive modified DOM trees.
Initially, null is set as the Schema
.
This processing will take effect even if
the DocumentBuilderFactory.isValidating()
method returns false.
It is an error to use
the http://java.sun.com/xml/jaxp/properties/schemaSource
property and/or the http://java.sun.com/xml/jaxp/properties/schemaLanguage
property in conjunction with a Schema
object.
Such configuration will cause a ParserConfigurationException
exception when the DocumentBuilderFactory.newDocumentBuilder()
is invoked.
A parser must be able to work with any Schema
implementation. However, parsers and schemas are allowed
to use implementation-specific custom mechanisms
as long as they yield the result described in the specification.
setSchema
in class javax.xml.parsers.DocumentBuilderFactory
grammar
- Schema
to use or null
to remove a schema.public boolean isXIncludeAware()
javax.xml.parsers.DocumentBuilderFactory
Get state of XInclude processing.
isXIncludeAware
in class javax.xml.parsers.DocumentBuilderFactory
public void setXIncludeAware(boolean state)
javax.xml.parsers.DocumentBuilderFactory
Set state of XInclude processing.
If XInclude markup is found in the document instance, should it be processed as specified in XML Inclusions (XInclude) Version 1.0.
XInclude processing defaults to false
.
setXIncludeAware
in class javax.xml.parsers.DocumentBuilderFactory
state
- Set XInclude processing to true
or
false
public boolean getFeature(java.lang.String name) throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.DocumentBuilderFactory
Get the state of the named feature.
Feature names are fully qualified URI
s.
Implementations may define their own features.
An ParserConfigurationException
is thrown if this DocumentBuilderFactory
or the
DocumentBuilder
s it creates cannot support the feature.
It is possible for an DocumentBuilderFactory
to expose a feature value but be unable to change its state.
getFeature
in class javax.xml.parsers.DocumentBuilderFactory
name
- Feature name.javax.xml.parsers.ParserConfigurationException
- if this DocumentBuilderFactory
or the DocumentBuilder
s it creates cannot support this feature.public void setFeature(java.lang.String name, boolean value) throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.DocumentBuilderFactory
Set a feature for this DocumentBuilderFactory
and DocumentBuilder
s created by this factory.
Feature names are fully qualified URI
s.
Implementations may define their own features.
An ParserConfigurationException
is thrown if this DocumentBuilderFactory
or the
DocumentBuilder
s it creates cannot support the feature.
It is possible for an DocumentBuilderFactory
to expose a feature value but be unable to change its state.
All implementations are required to support the XMLConstants.FEATURE_SECURE_PROCESSING
feature.
When the feature is:
true
: the implementation will limit XML processing to conform to implementation limits.
Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources.
If XML processing is limited for security reasons, it will be reported via a call to the registered
ErrorHandler.fatalError(SAXParseException exception)
.
See DocumentBuilder.setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
.
false
: the implementation will processing XML according to the XML specifications without
regard to possible implementation limits.
setFeature
in class javax.xml.parsers.DocumentBuilderFactory
name
- Feature name.value
- Is feature state true
or false
.javax.xml.parsers.ParserConfigurationException
- if this DocumentBuilderFactory
or the DocumentBuilder
s
it creates cannot support this feature.Copyright © 1999-2022 The Apache Software Foundation. All Rights Reserved.