Top Description Fields Constructors Methods
org.eclipse.persistence.platform.xml.jaxp

public Class JAXPParser

extends Object
implements XMLParser
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.platform.xml.XMLParser
Imports
java.io.File, .IOException, .InputStream, .Reader, java.net.URL, java.util.Map, .Map.Entry, javax.xml.parsers.DocumentBuilder, .DocumentBuilderFactory, .ParserConfigurationException, javax.xml.transform.Source, .Transformer, .TransformerException, .TransformerFactory, javax.xml.transform.sax.SAXResult, javax.xml.validation.Schema, org.eclipse.persistence.internal.helper.XMLHelper, org.eclipse.persistence.platform.xml.DefaultErrorHandler, .SAXDocumentBuilder, .XMLParser, .XMLPlatformException, org.w3c.dom.Document, org.xml.sax.EntityResolver, .ErrorHandler, .InputSource, .SAXException, .SAXParseException

Purpose: An implementation of XMLParser using JAXP 1.3 APIs.

JAXPParser is NOT thread safe.

Field Summary

Modifier and TypeField and Description
private DocumentBuilder
private DocumentBuilderFactory
private EntityResolver
private ErrorHandler
private static final String
private static final String
private TransformerFactory
private static final String

Constructor Summary

AccessConstructor and Description
public
JAXPParser()

Default constructor.

public
JAXPParser(DocumentBuilderFactory
existing document builder factory
documentBuilderFactory
,
ErrorHandler
existing error handler
errorHandler
)

This constructor can increase performance by providing existing documentBuilderFactory and errorHandler.

public
JAXPParser(Map<String, Boolean>
features for parser
parserFeatures
)

This constructor provides way to specify features for parser.

Method Summary

Modifier and TypeMethod and Description
private DocumentBuilder
public EntityResolver

Returns:

entity resolver of the parser
getEntityResolver
()

Implements org.eclipse.persistence.platform.xml.XMLParser.getEntityResolver.

Returns entity resolver of the parser.
public ErrorHandler

Returns:

error handler of the parser
getErrorHandler
()

Implements org.eclipse.persistence.platform.xml.XMLParser.getErrorHandler.

Returns error handler of the parser.
private DocumentBuilder
public int

Returns:

validation mode of the parser
getValidationMode
()

Implements org.eclipse.persistence.platform.xml.XMLParser.getValidationMode.

Returns validtion mode of the parser.
public Schema

Returns:

schema of the parser
getXMLSchema
()

Implements org.eclipse.persistence.platform.xml.XMLParser.getXMLSchema.

Returns XML Schema of the parser.
private void
public Document

Returns:

parsed document
parse
(InputSource
input source to parse
inputSource
)

Implements org.eclipse.persistence.platform.xml.XMLParser.parse.

Parses given input source.
public Document

Returns:

parsed document
parse
(File
file to parse
file
)

Implements org.eclipse.persistence.platform.xml.XMLParser.parse.

Parses given file.
public Document

Returns:

parsed document
parse
(InputStream
input stream to parse
inputStream
)

Implements org.eclipse.persistence.platform.xml.XMLParser.parse.

Parses given input stream.
public Document

Returns:

parsed document
parse
(Reader
reader to parse
reader
)

Implements org.eclipse.persistence.platform.xml.XMLParser.parse.

Parses given reader.
public Document

Returns:

parsed document
parse
(Source
source to parse
source
)

Implements org.eclipse.persistence.platform.xml.XMLParser.parse.

Parses given source.
public Document

Returns:

parsed document
parse
(URL
url to parse
url
)

Implements org.eclipse.persistence.platform.xml.XMLParser.parse.

Parses given url.
public void
setEntityResolver(EntityResolver
entity resolver to set
entityResolver
)

Implements org.eclipse.persistence.platform.xml.XMLParser.setEntityResolver.

Sets entity resolver for the parser.
public void
setErrorHandler(ErrorHandler
error handler for the parser
errorHandler
)

Implements org.eclipse.persistence.platform.xml.XMLParser.setErrorHandler.

Sets error handler for the parser.
public void
setNamespaceAware(boolean
if the parser should be namespace aware
isNamespaceAware
)

Implements org.eclipse.persistence.platform.xml.XMLParser.setNamespaceAware.

Changes namespaceAware behavior of the parser.
public void
setValidationMode(int
validation mode to set
validationMode
)

Implements org.eclipse.persistence.platform.xml.XMLParser.setValidationMode.

Sets validation mode of the parser.
public void
setWhitespacePreserving(boolean
if the parser should preserve white spaces
isWhitespacePreserving
)

Implements org.eclipse.persistence.platform.xml.XMLParser.setWhitespacePreserving.

Changes preservation of white spaces.
public void
setXMLSchema(URL
url of the XMLSchema
url
)

Implements org.eclipse.persistence.platform.xml.XMLParser.setXMLSchema.

Sets XML Schema for the parser.
public void
setXMLSchema(Schema
schema for the parser
schema
)

Implements org.eclipse.persistence.platform.xml.XMLParser.setXMLSchema.

Sets XML Schema for the parser.
public void
setXMLSchemas(Object[]
XML schemas to set
schemas
)

Implements org.eclipse.persistence.platform.xml.XMLParser.setXMLSchemas.

Sets XML Schema(s) for the parser.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

documentBuilderback to summary
private DocumentBuilder documentBuilder
documentBuilderFactoryback to summary
private DocumentBuilderFactory documentBuilderFactory
entityResolverback to summary
private EntityResolver entityResolver
errorHandlerback to summary
private ErrorHandler errorHandler
JAXP_SCHEMA_SOURCEback to summary
private static final String JAXP_SCHEMA_SOURCE
SCHEMA_LANGUAGEback to summary
private static final String SCHEMA_LANGUAGE
transformerFactoryback to summary
private TransformerFactory transformerFactory
XML_SCHEMAback to summary
private static final String XML_SCHEMA

Constructor Detail

JAXPParserback to summary
public JAXPParser()

Default constructor.

JAXPParserback to summary
public JAXPParser(DocumentBuilderFactory documentBuilderFactory, ErrorHandler errorHandler)

This constructor can increase performance by providing existing documentBuilderFactory and errorHandler.

Parameters
documentBuilderFactory:DocumentBuilderFactory

existing document builder factory

errorHandler:ErrorHandler

existing error handler

JAXPParserback to summary
public JAXPParser(Map<String, Boolean> parserFeatures)

This constructor provides way to specify features for parser.

Parameters
parserFeatures:Map<String, Boolean>

features for parser

Method Detail

getDocumentBuilderback to summary
private DocumentBuilder getDocumentBuilder()
getEntityResolverback to summary
public EntityResolver getEntityResolver()

Implements org.eclipse.persistence.platform.xml.XMLParser.getEntityResolver.

Returns entity resolver of the parser.

Returns:EntityResolver

entity resolver of the parser

Annotations
@Override
getErrorHandlerback to summary
public ErrorHandler getErrorHandler()

Implements org.eclipse.persistence.platform.xml.XMLParser.getErrorHandler.

Returns error handler of the parser.

Returns:ErrorHandler

error handler of the parser

Annotations
@Override
getNewDocumentBuilderback to summary
private DocumentBuilder getNewDocumentBuilder() throws ParserConfigurationException
getValidationModeback to summary
public int getValidationMode()

Implements org.eclipse.persistence.platform.xml.XMLParser.getValidationMode.

Returns validtion mode of the parser.

Returns:int

validation mode of the parser

Annotations
@Override
getXMLSchemaback to summary
public Schema getXMLSchema() throws XMLPlatformException

Implements org.eclipse.persistence.platform.xml.XMLParser.getXMLSchema.

Returns XML Schema of the parser.

Returns:Schema

schema of the parser

Annotations
@Override
Exceptions
XMLPlatformException:
exception occurred while getting XMLSchema
loadDocumentBuilderFactoryback to summary
private void loadDocumentBuilderFactory()
parseback to summary
public Document parse(InputSource inputSource) throws XMLPlatformException

Implements org.eclipse.persistence.platform.xml.XMLParser.parse.

Parses given input source.

Parameters
inputSource:InputSource

input source to parse

Returns:Document

parsed document

Annotations
@Override
Exceptions
XMLPlatformException:
exception occurred while parsing input source
parseback to summary
public Document parse(File file) throws XMLPlatformException

Implements org.eclipse.persistence.platform.xml.XMLParser.parse.

Parses given file.

Parameters
file:File

file to parse

Returns:Document

parsed document

Annotations
@Override
Exceptions
XMLPlatformException:
exception occurred while parsing given file
parseback to summary
public Document parse(InputStream inputStream) throws XMLPlatformException

Implements org.eclipse.persistence.platform.xml.XMLParser.parse.

Parses given input stream.

Parameters
inputStream:InputStream

input stream to parse

Returns:Document

parsed document

Annotations
@Override
Exceptions
XMLPlatformException:
exception occurred while parsing input stream
parseback to summary
public Document parse(Reader reader) throws XMLPlatformException

Implements org.eclipse.persistence.platform.xml.XMLParser.parse.

Parses given reader.

Parameters
reader:Reader

reader to parse

Returns:Document

parsed document

Annotations
@Override
Exceptions
XMLPlatformException:
exception occurred while parsing given reader
parseback to summary
public Document parse(Source source) throws XMLPlatformException

Implements org.eclipse.persistence.platform.xml.XMLParser.parse.

Parses given source.

Parameters
source:Source

source to parse

Returns:Document

parsed document

Annotations
@Override
Exceptions
XMLPlatformException:
exception occurred while parsing given source
parseback to summary
public Document parse(URL url) throws XMLPlatformException

Implements org.eclipse.persistence.platform.xml.XMLParser.parse.

Parses given url.

Parameters
url:URL

url to parse

Returns:Document

parsed document

Annotations
@Override
Exceptions
XMLPlatformException:
exception occurred while parsing stream with given url
setEntityResolverback to summary
public void setEntityResolver(EntityResolver entityResolver)

Implements org.eclipse.persistence.platform.xml.XMLParser.setEntityResolver.

Sets entity resolver for the parser.

Parameters
entityResolver:EntityResolver

entity resolver to set

Annotations
@Override
setErrorHandlerback to summary
public void setErrorHandler(ErrorHandler errorHandler)

Implements org.eclipse.persistence.platform.xml.XMLParser.setErrorHandler.

Sets error handler for the parser.

Parameters
errorHandler:ErrorHandler

error handler for the parser

Annotations
@Override
setNamespaceAwareback to summary
public void setNamespaceAware(boolean isNamespaceAware)

Implements org.eclipse.persistence.platform.xml.XMLParser.setNamespaceAware.

Changes namespaceAware behavior of the parser.

Parameters
isNamespaceAware:boolean

if the parser should be namespace aware

Annotations
@Override
setValidationModeback to summary
public void setValidationMode(int validationMode)

Implements org.eclipse.persistence.platform.xml.XMLParser.setValidationMode.

Sets validation mode of the parser.

Parameters
validationMode:int

validation mode to set

Annotations
@Override
setWhitespacePreservingback to summary
public void setWhitespacePreserving(boolean isWhitespacePreserving)

Implements org.eclipse.persistence.platform.xml.XMLParser.setWhitespacePreserving.

Changes preservation of white spaces.

Parameters
isWhitespacePreserving:boolean

if the parser should preserve white spaces

Annotations
@Override
setXMLSchemaback to summary
public void setXMLSchema(URL url) throws XMLPlatformException

Implements org.eclipse.persistence.platform.xml.XMLParser.setXMLSchema.

Sets XML Schema for the parser.

Parameters
url:URL

url of the XMLSchema

Annotations
@Override
Exceptions
XMLPlatformException:
exception occurred while setting XMLSchema
setXMLSchemaback to summary
public void setXMLSchema(Schema schema) throws XMLPlatformException

Implements org.eclipse.persistence.platform.xml.XMLParser.setXMLSchema.

Sets XML Schema for the parser.

Parameters
schema:Schema

schema for the parser

Annotations
@Override
Exceptions
XMLPlatformException:
exception occurred while setting XMLSchema
setXMLSchemasback to summary
public void setXMLSchemas(Object[] schemas) throws XMLPlatformException

Implements org.eclipse.persistence.platform.xml.XMLParser.setXMLSchemas.

Sets XML Schema(s) for the parser.

Parameters
schemas:Object[]

XML schemas to set

Annotations
@Override
Exceptions
XMLPlatformException:
exception occurred while setting XMLSchema(s)