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

pack-priv Class DocumentBuilderImpl

extends DocumentBuilder
Class Inheritance
Imports
java.io.File, .IOException, .InputStream, javax.xml.parsers.DocumentBuilder, .ParserConfigurationException, org.iso_relax.verifier.Schema, .Verifier, org.w3c.dom.DOMImplementation, .Document, org.xml.sax.EntityResolver, .ErrorHandler, .InputSource, .SAXException

DocumentBuilder implementation that supports validation.

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

Author
Kohsuke KAWAGUCHI

Field Summary

Modifier and TypeField and Description
private final DocumentBuilder
core

Wrapped DocumentBuilder that does everything else.

private final Verifier
verifier

The validation will be performed using this verifier.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public DOMImplementation
public boolean
isNamespaceAware()

Implements abstract javax.xml.parsers.DocumentBuilder.isNamespaceAware.

Indicates whether or not this parser is configured to understand namespaces.
public boolean
isValidating()

Implements abstract javax.xml.parsers.DocumentBuilder.isValidating.

Indicates whether or not this parser is configured to validate XML documents.
public Document
newDocument()

Implements abstract javax.xml.parsers.DocumentBuilder.newDocument.

Obtain a new instance of a DOM Document object to build a DOM tree with.
public Document
parse(InputSource
InputSource containing the content to be parsed.
is
)

Implements abstract javax.xml.parsers.DocumentBuilder.parse.

Parse the content of the given input source as an XML document and return a new DOM Document object.
public Document
parse(File
The file containing the XML to parse.
f
)

Overrides javax.xml.parsers.DocumentBuilder.parse.

Parse the content of the given file as an XML document and return a new DOM Document object.
public Document
parse(InputStream
InputStream containing the content to be parsed.
is
)

Overrides javax.xml.parsers.DocumentBuilder.parse.

Parse the content of the given InputStream as an XML document and return a new DOM Document object.
public Document
parse(InputStream
InputStream containing the content to be parsed.
is
,
String
Provide a base for resolving relative URIs.
systemId
)

Overrides javax.xml.parsers.DocumentBuilder.parse.

Parse the content of the given InputStream as an XML document and return a new DOM Document object.
public Document
parse(String
The location of the content to be parsed.
url
)

Overrides javax.xml.parsers.DocumentBuilder.parse.

Parse the content of the given URI as an XML document and return a new DOM Document object.
public void
setEntityResolver(EntityResolver
The EntityResolver to be used to resolve entities present in the XML document to be parsed.
resolver
)

Implements abstract javax.xml.parsers.DocumentBuilder.setEntityResolver.

Specify the EntityResolver to be used to resolve entities present in the XML document to be parsed.
public void
setErrorHandler(ErrorHandler
The ErrorHandler to be used by the parser.
handler
)

Implements abstract javax.xml.parsers.DocumentBuilder.setErrorHandler.

Specify the ErrorHandler to be used by the parser.
private Document
verify(Document dom)

Validates a given DOM and returns it if it is valid.

Inherited from javax.xml.parsers.DocumentBuilder:
getSchemaisXIncludeAwarereset

Field Detail

coreback to summary
private final DocumentBuilder core

Wrapped DocumentBuilder that does everything else.

verifierback to summary
private final Verifier verifier

The validation will be performed using this verifier.

Constructor Detail

DocumentBuilderImplback to summary
pack-priv DocumentBuilderImpl(DocumentBuilder _core, Schema _schema) throws ParserConfigurationException

Method Detail

getDOMImplementationback to summary
public DOMImplementation getDOMImplementation()

Implements abstract javax.xml.parsers.DocumentBuilder.getDOMImplementation.

Doc from javax.xml.parsers.DocumentBuilder.getDOMImplementation.

Obtain an instance of a DOMImplementation object.

Returns:DOMImplementation

A new instance of a DOMImplementation.

isNamespaceAwareback to summary
public boolean isNamespaceAware()

Implements abstract javax.xml.parsers.DocumentBuilder.isNamespaceAware.

Doc from javax.xml.parsers.DocumentBuilder.isNamespaceAware.

Indicates whether or not this parser is configured to understand namespaces.

Returns:boolean

true if this parser is configured to understand namespaces; false otherwise.

isValidatingback to summary
public boolean isValidating()

Implements abstract javax.xml.parsers.DocumentBuilder.isValidating.

Doc from javax.xml.parsers.DocumentBuilder.isValidating.

Indicates whether or not this parser is configured to validate XML documents.

Returns:boolean

true if this parser is configured to validate XML documents; false otherwise.

newDocumentback to summary
public Document newDocument()

Implements abstract javax.xml.parsers.DocumentBuilder.newDocument.

Doc from javax.xml.parsers.DocumentBuilder.newDocument.

Obtain a new instance of a DOM Document object to build a DOM tree with.

Returns:Document

A new instance of a DOM Document object.

parseback to summary
public Document parse(InputSource is) throws SAXException, IOException

Implements abstract javax.xml.parsers.DocumentBuilder.parse.

Doc from javax.xml.parsers.DocumentBuilder.parse.

Parse the content of the given input source as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the InputSource is null.

Parameters
is:InputSource

InputSource containing the content to be parsed.

Returns:Document

A new DOM Document object.

Exceptions
SAXException:
If any parse errors occur.
IOException:
If any IO errors occur.
parseback to summary
public Document parse(File f) throws SAXException, IOException

Overrides javax.xml.parsers.DocumentBuilder.parse.

Doc from javax.xml.parsers.DocumentBuilder.parse.

Parse the content of the given file as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the File is null.

Parameters
f:File

The file containing the XML to parse.

Returns:Document

A new DOM Document object.

Exceptions
SAXException:
If any parse errors occur.
IOException:
If any IO errors occur.
parseback to summary
public Document parse(InputStream is) throws SAXException, IOException

Overrides javax.xml.parsers.DocumentBuilder.parse.

Doc from javax.xml.parsers.DocumentBuilder.parse.

Parse the content of the given InputStream as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the InputStream is null.

Parameters
is:InputStream

InputStream containing the content to be parsed.

Returns:Document

Document result of parsing the InputStream

Exceptions
SAXException:
If any parse errors occur.
IOException:
If any IO errors occur.
parseback to summary
public Document parse(InputStream is, String systemId) throws SAXException, IOException

Overrides javax.xml.parsers.DocumentBuilder.parse.

Doc from javax.xml.parsers.DocumentBuilder.parse.

Parse the content of the given InputStream as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the InputStream is null.

Parameters
is:InputStream

InputStream containing the content to be parsed.

systemId:String

Provide a base for resolving relative URIs.

Returns:Document

A new DOM Document object.

Exceptions
SAXException:
If any parse errors occur.
IOException:
If any IO errors occur.
parseback to summary
public Document parse(String url) throws SAXException, IOException

Overrides javax.xml.parsers.DocumentBuilder.parse.

Doc from javax.xml.parsers.DocumentBuilder.parse.

Parse the content of the given URI as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the URI is null.

Parameters
url:String

The location of the content to be parsed.

Returns:Document

A new DOM Document object.

Exceptions
SAXException:
If any parse errors occur.
IOException:
If any IO errors occur.
setEntityResolverback to summary
public void setEntityResolver(EntityResolver resolver)

Implements abstract javax.xml.parsers.DocumentBuilder.setEntityResolver.

Doc from javax.xml.parsers.DocumentBuilder.setEntityResolver.

Specify the EntityResolver to be used to resolve entities present in the XML document to be parsed. Setting this to null will result in the underlying implementation using it's own default implementation and behavior.

Parameters
resolver:EntityResolver

The EntityResolver to be used to resolve entities present in the XML document to be parsed.

setErrorHandlerback to summary
public void setErrorHandler(ErrorHandler handler)

Implements abstract javax.xml.parsers.DocumentBuilder.setErrorHandler.

Doc from javax.xml.parsers.DocumentBuilder.setErrorHandler.

Specify the ErrorHandler to be used by the parser. Setting this to null will result in the underlying implementation using it's own default implementation and behavior.

Parameters
handler:ErrorHandler

The ErrorHandler to be used by the parser.

verifyback to summary
private Document verify(Document dom) throws SAXException, IOException

Validates a given DOM and returns it if it is valid. Otherwise throw an exception.