Top Description Fields Constructors Methods
com.sun.msv.verifier.jaxp

public Class DocumentBuilderFactoryImpl

extends DocumentBuilderFactory
Class Inheritance
Imports
java.io.File, .InputStream, javax.xml.parsers.DocumentBuilder, .DocumentBuilderFactory, .ParserConfigurationException, org.iso_relax.verifier.Schema, .VerifierFactory, org.xml.sax.InputSource, .SAXException, com.sun.msv.verifier.jarv.TheFactoryImpl

DocumentBuilderFactory implementation that supports validation.

This class uses another DocumentBuilderFactory implementation and adds the validation capability to it.

Author
Kohsuke KAWAGUCHI

Field Summary

Modifier and TypeField and Description
private final DocumentBuilderFactory
core

Wrapped DocumentBuilderFactory that does everything else.

private final VerifierFactory
jarvFactory

JARV VerifierFactory implementation, which will be used to parse schemas.

private Schema
schema

The validation will be performed against this schema object.

Constructor Summary

AccessConstructor and Description
public
DocumentBuilderFactoryImpl()

Creates a new instance by using the default DocumentBuilderFactory implementation as the underlying parser.

public
DocumentBuilderFactoryImpl(DocumentBuilderFactory _factory)

Creates a new instance by specifying the underlying SAXParserFactory implementation.

public

Method Summary

Modifier and TypeMethod and Description
public Object
getAttribute(String
The name of the attribute.
name
)

Implements abstract javax.xml.parsers.DocumentBuilderFactory.getAttribute.

Allows the user to retrieve specific attributes on the underlying implementation.
public boolean
getFeature(String
Feature name.
name
)

Implements abstract javax.xml.parsers.DocumentBuilderFactory.getFeature.

Get the state of the named feature.
public boolean
isCoalescing()

Overrides javax.xml.parsers.DocumentBuilderFactory.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.
public boolean
public boolean
isIgnoringComments()

Overrides javax.xml.parsers.DocumentBuilderFactory.isIgnoringComments.

Indicates whether or not the factory is configured to produce parsers which ignores comments.
public boolean
isIgnoringElementContentWhitespace()

Overrides javax.xml.parsers.DocumentBuilderFactory.isIgnoringElementContentWhitespace.

Indicates whether or not the factory is configured to produce parsers which ignore ignorable whitespace in element content.
public boolean
isNamespaceAware()

Overrides javax.xml.parsers.DocumentBuilderFactory.isNamespaceAware.

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

Overrides javax.xml.parsers.DocumentBuilderFactory.isValidating.

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

Implements abstract javax.xml.parsers.DocumentBuilderFactory.newDocumentBuilder.

Creates a new instance of a javax.xml.parsers.DocumentBuilder using the currently configured parameters.
public void
setAttribute(String
The name of the attribute.
name
,
Object
The value of the attribute.
value
)

Implements abstract javax.xml.parsers.DocumentBuilderFactory.setAttribute.

Allows the user to set specific attributes on the underlying implementation.
public void
setCoalescing(boolean
true if the parser produced will convert CDATA nodes to Text nodes and append it to the adjacent (if any) text node; false otherwise.
newVal
)

Overrides javax.xml.parsers.DocumentBuilderFactory.setCoalescing.

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.
public void
setExpandEntityReference(boolean newVal)

public void
setFeature(String
Feature name.
name
,
boolean
Is feature state true or false.
value
)

Implements abstract javax.xml.parsers.DocumentBuilderFactory.setFeature.

Set a feature for this DocumentBuilderFactory and DocumentBuilders created by this factory.
public void
setIgnoringComments(boolean
boolean value to ignore comments during processing
newVal
)

Overrides javax.xml.parsers.DocumentBuilderFactory.setIgnoringComments.

Specifies that the parser produced by this code will ignore comments.
public void
setIgnoringElementContentWhitespace(boolean
true if the parser created must eliminate whitespace in the element content when parsing XML documents; false otherwise.
newVal
)

Overrides javax.xml.parsers.DocumentBuilderFactory.setIgnoringElementContentWhitespace.

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).
public void
setNamespaceAware(boolean
true if the parser produced will provide support for XML namespaces; false otherwise.
newVal
)

Overrides javax.xml.parsers.DocumentBuilderFactory.setNamespaceAware.

Specifies that the parser produced by this code will provide support for XML namespaces.
public void
setValidating(boolean
true if the parser produced will validate documents as they are parsed; false otherwise.
newVal
)

Overrides javax.xml.parsers.DocumentBuilderFactory.setValidating.

Specifies that the parser produced by this code will validate documents as they are parsed.
Inherited from javax.xml.parsers.DocumentBuilderFactory:
getSchemaisExpandEntityReferencesisXIncludeAwarenewDefaultInstancenewDefaultNSInstancenewInstancenewInstancenewNSInstancenewNSInstancesetExpandEntityReferencessetSchemasetXIncludeAware

Field Detail

coreback to summary
private final DocumentBuilderFactory core

Wrapped DocumentBuilderFactory that does everything else.

jarvFactoryback to summary
private final VerifierFactory jarvFactory

JARV VerifierFactory implementation, which will be used to parse schemas.

schemaback to summary
private Schema schema

The validation will be performed against this schema object.

Constructor Detail

DocumentBuilderFactoryImplback to summary
public DocumentBuilderFactoryImpl()

Creates a new instance by using the default DocumentBuilderFactory implementation as the underlying parser. This constructor does not set any schema.

DocumentBuilderFactoryImplback to summary
public DocumentBuilderFactoryImpl(DocumentBuilderFactory _factory)

Creates a new instance by specifying the underlying SAXParserFactory implementation. This constructor does not set any schema.

DocumentBuilderFactoryImplback to summary
public DocumentBuilderFactoryImpl(DocumentBuilderFactory _factory, Schema _schema)

Method Detail

getAttributeback to summary
public Object getAttribute(String name)

Implements abstract javax.xml.parsers.DocumentBuilderFactory.getAttribute.

Doc from javax.xml.parsers.DocumentBuilderFactory.getAttribute.

Allows the user to retrieve specific attributes on the underlying implementation.

Parameters
name:String

The name of the attribute.

Returns:Object

value The value of the attribute.

getFeatureback to summary
public boolean getFeature(String name)

Implements abstract javax.xml.parsers.DocumentBuilderFactory.getFeature.

Doc from javax.xml.parsers.DocumentBuilderFactory.getFeature.

Get the state of the named feature.

Feature names are fully qualified java.net.URIs. Implementations may define their own features. An ParserConfigurationException is thrown if this DocumentBuilderFactory or the DocumentBuilders it creates cannot support the feature. It is possible for an DocumentBuilderFactory to expose a feature value but be unable to change its state.

Parameters
name:String

Feature name.

Returns:boolean

State of the named feature.

isCoalescingback to summary
public boolean isCoalescing()

Overrides javax.xml.parsers.DocumentBuilderFactory.isCoalescing.

Doc from javax.xml.parsers.DocumentBuilderFactory.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.

Returns:boolean

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.

isExpandEntityReferenceback to summary
public boolean isExpandEntityReference()
isIgnoringCommentsback to summary
public boolean isIgnoringComments()

Overrides javax.xml.parsers.DocumentBuilderFactory.isIgnoringComments.

Doc from javax.xml.parsers.DocumentBuilderFactory.isIgnoringComments.

Indicates whether or not the factory is configured to produce parsers which ignores comments.

Returns:boolean

true if the factory is configured to produce parsers which ignores comments; false otherwise.

isIgnoringElementContentWhitespaceback to summary
public boolean isIgnoringElementContentWhitespace()

Overrides javax.xml.parsers.DocumentBuilderFactory.isIgnoringElementContentWhitespace.

Doc from javax.xml.parsers.DocumentBuilderFactory.isIgnoringElementContentWhitespace.

Indicates whether or not the factory is configured to produce parsers which ignore ignorable whitespace in element content.

Returns:boolean

true if the factory is configured to produce parsers which ignore ignorable whitespace in element content; false otherwise.

isNamespaceAwareback to summary
public boolean isNamespaceAware()

Overrides javax.xml.parsers.DocumentBuilderFactory.isNamespaceAware.

Doc from javax.xml.parsers.DocumentBuilderFactory.isNamespaceAware.

Indicates whether or not the factory is configured to produce parsers which are namespace aware.

Returns:boolean

true if the factory is configured to produce parsers which are namespace aware; false otherwise.

isValidatingback to summary
public boolean isValidating()

Overrides javax.xml.parsers.DocumentBuilderFactory.isValidating.

Doc from javax.xml.parsers.DocumentBuilderFactory.isValidating.

Indicates whether or not the factory is configured to produce parsers which validate the XML content during parse.

Returns:boolean

true if the factory is configured to produce parsers which validate the XML content during parse; false otherwise.

newDocumentBuilderback to summary
public DocumentBuilder newDocumentBuilder() throws ParserConfigurationException

Implements abstract javax.xml.parsers.DocumentBuilderFactory.newDocumentBuilder.

Doc from javax.xml.parsers.DocumentBuilderFactory.newDocumentBuilder.

Creates a new instance of a javax.xml.parsers.DocumentBuilder using the currently configured parameters.

Returns:DocumentBuilder

A new instance of a DocumentBuilder.

Exceptions
ParserConfigurationException:
if a DocumentBuilder cannot be created which satisfies the configuration requested.
setAttributeback to summary
public void setAttribute(String name, Object value)

Implements abstract javax.xml.parsers.DocumentBuilderFactory.setAttribute.

Doc from javax.xml.parsers.DocumentBuilderFactory.setAttribute.

Allows the user to set specific attributes on the underlying implementation.

All implementations that implement JAXP 1.5 or newer are required to support the javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD and javax.xml.XMLConstants#ACCESS_EXTERNAL_SCHEMA properties.

Parameters
name:String

The name of the attribute.

value:Object

The value of the attribute.

setCoalescingback to summary
public void setCoalescing(boolean newVal)

Overrides javax.xml.parsers.DocumentBuilderFactory.setCoalescing.

Doc from javax.xml.parsers.DocumentBuilderFactory.setCoalescing.

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. By default the value of this is set to false

Parameters
newVal:boolean

true if the parser produced will convert CDATA nodes to Text nodes and append it to the adjacent (if any) text node; false otherwise.

setExpandEntityReferenceback to summary
public void setExpandEntityReference(boolean newVal)
setFeatureback to summary
public void setFeature(String name, boolean value)

Implements abstract javax.xml.parsers.DocumentBuilderFactory.setFeature.

Doc from javax.xml.parsers.DocumentBuilderFactory.setFeature.

Set a feature for this DocumentBuilderFactory and DocumentBuilders created by this factory.

Feature names are fully qualified java.net.URIs. Implementations may define their own features. A ParserConfigurationException is thrown if this DocumentBuilderFactory or the DocumentBuilders it creates cannot support the feature. It is possible for a DocumentBuilderFactory to expose a feature value but be unable to change its state.

All implementations are required to support the javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING feature. When the feature is:

Parameters
name:String

Feature name.

value:boolean

Is feature state true or false.

setIgnoringCommentsback to summary
public void setIgnoringComments(boolean newVal)

Overrides javax.xml.parsers.DocumentBuilderFactory.setIgnoringComments.

Doc from javax.xml.parsers.DocumentBuilderFactory.setIgnoringComments.

Specifies that the parser produced by this code will ignore comments. By default the value of this is set to false.

Parameters
newVal:boolean

boolean value to ignore comments during processing

setIgnoringElementContentWhitespaceback to summary
public void setIgnoringElementContentWhitespace(boolean newVal)

Overrides javax.xml.parsers.DocumentBuilderFactory.setIgnoringElementContentWhitespace.

Doc from javax.xml.parsers.DocumentBuilderFactory.setIgnoringElementContentWhitespace.

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). Note that only whitespace which is directly contained within element content that has an element only content model (see XML Rec 3.2.1) will be eliminated. Due to reliance on the content model this setting requires the parser to be in validating mode. By default the value of this is set to false.

Parameters
newVal:boolean

true if the parser created must eliminate whitespace in the element content when parsing XML documents; false otherwise.

setNamespaceAwareback to summary
public void setNamespaceAware(boolean newVal)

Overrides javax.xml.parsers.DocumentBuilderFactory.setNamespaceAware.

Doc from javax.xml.parsers.DocumentBuilderFactory.setNamespaceAware.

Specifies that the parser produced by this code will provide support for XML namespaces. By default the value of this is set to false

Parameters
newVal:boolean

true if the parser produced will provide support for XML namespaces; false otherwise.

setValidatingback to summary
public void setValidating(boolean newVal)

Overrides javax.xml.parsers.DocumentBuilderFactory.setValidating.

Doc from javax.xml.parsers.DocumentBuilderFactory.setValidating.

Specifies that the parser produced by this code will validate documents as they are parsed. By default the value of this is set to false.

Note that "the validation" here means a validating parser as defined in the XML recommendation. In other words, it essentially just controls the DTD validation. (except the legacy two properties defined in JAXP 1.2.)

To use modern schema languages such as W3C XML Schema or RELAX NG instead of DTD, you can configure your parser to be a non-validating parser by leaving the setValidating(boolean) method false, then use the setSchema(Schema) method to associate a schema to a parser.

Parameters
newVal:boolean

true if the parser produced will validate documents as they are parsed; false otherwise.