APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xerces.internal.jaxp

public Class SAXParserFactoryImpl

extends SAXParserFactory
Class Inheritance
Imports
com.sun.org.apache.xerces.internal.impl.Constants, java.util.HashMap, .Map, javax.xml.XMLConstants, javax.xml.parsers.ParserConfigurationException, .SAXParser, .SAXParserFactory, javax.xml.validation.Schema, jdk.xml.internal.JdkXmlConfig, .XMLSecurityManager, .XMLSecurityPropertyManager, org.xml.sax.SAXException, .SAXNotRecognizedException, .SAXNotSupportedException

This is the implementation specific class for the javax.xml.parsers.SAXParserFactory. This is the platform default implementation for the platform.
Authors
Rajiv Mordani, Edwin Goei

Field Summary

Modifier and TypeField and Description
private Map<String, Boolean>
private boolean
fSecureProcess

State of the secure processing feature, initially false

pack-priv XMLSecurityManager
pack-priv XMLSecurityPropertyManager
private Schema
private boolean
private static final String
NAMESPACES_FEATURE

Feature identifier: namespaces.

private static final String
VALIDATION_FEATURE

Feature identifier: validation.

private static final String
XINCLUDE_FEATURE

Feature identifier: XInclude processing

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
getFeature(String name)

Implements abstract javax.xml.parsers.SAXParserFactory.getFeature.

returns the particular property requested for in the underlying implementation of org.xml.sax.XMLReader.

private boolean
public Schema
getSchema()

Overrides javax.xml.parsers.SAXParserFactory.getSchema.

Gets the Schema object specified through the setSchema(Schema schema) method.

public boolean
isNamespaceAware()

Overrides javax.xml.parsers.SAXParserFactory.isNamespaceAware.

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

public boolean
isValidating()

Overrides javax.xml.parsers.SAXParserFactory.isValidating.

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

public boolean
isXIncludeAware()

Overrides javax.xml.parsers.SAXParserFactory.isXIncludeAware.

Get state of XInclude processing.

public SAXParser

Returns:

javax.xml.parsers.SAXParser
newSAXParser
()

Implements abstract javax.xml.parsers.SAXParserFactory.newSAXParser.

Creates a new instance of SAXParser using the currently configured factory parameters.

private SAXParserImpl
newSAXParserImpl()

Common code for translating exceptions

private void
putInFeatures(String name, boolean value)

public void
setFeature(String name, boolean value)

Implements abstract javax.xml.parsers.SAXParserFactory.setFeature.

Sets the particular feature in the underlying implementation of org.xml.sax.XMLReader.

public void
setNamespaceAware(boolean awareness)

Overrides javax.xml.parsers.SAXParserFactory.setNamespaceAware.

Specifies that the parser produced by this code will provide support for XML namespaces.

public void
setSchema(Schema grammar)

Overrides javax.xml.parsers.SAXParserFactory.setSchema.

Set the Schema to be used by parsers created from this factory.

public void
setValidating(boolean validating)

Overrides javax.xml.parsers.SAXParserFactory.setValidating.

Specifies that the parser produced by this code will validate documents as they are parsed.

public void
setXIncludeAware(boolean state)

Overrides javax.xml.parsers.SAXParserFactory.setXIncludeAware.

Set state of XInclude processing.

Inherited from javax.xml.parsers.SAXParserFactory:
newDefaultInstancenewDefaultNSInstancenewInstancenewInstancenewNSInstancenewNSInstance

Field Detail

featuresback to summary
private Map<String, Boolean> features
fSecureProcessback to summary
private boolean fSecureProcess

State of the secure processing feature, initially false

fSecurityManagerback to summary
pack-priv XMLSecurityManager fSecurityManager
fSecurityPropertyMgrback to summary
pack-priv XMLSecurityPropertyManager fSecurityPropertyMgr
grammarback to summary
private Schema grammar
isXIncludeAwareback to summary
private boolean isXIncludeAware
NAMESPACES_FEATUREback to summary
private static final String NAMESPACES_FEATURE

Feature identifier: namespaces.

VALIDATION_FEATUREback to summary
private static final String VALIDATION_FEATURE

Feature identifier: validation.

XINCLUDE_FEATUREback to summary
private static final String XINCLUDE_FEATURE

Feature identifier: XInclude processing

Constructor Detail

SAXParserFactoryImplback to summary
public SAXParserFactoryImpl()

Method Detail

getFeatureback to summary
public boolean getFeature(String name) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException

Implements abstract javax.xml.parsers.SAXParserFactory.getFeature.

returns the particular property requested for in the underlying implementation of org.xml.sax.XMLReader.

Exceptions
ParserConfigurationException:

Doc from javax.xml.parsers.SAXParserFactory.getFeature.

if a parser cannot be created which satisfies the requested configuration.

SAXNotRecognizedException:

Doc from javax.xml.parsers.SAXParserFactory.getFeature.

When the underlying XMLReader does not recognize the property name.

SAXNotSupportedException:

Doc from javax.xml.parsers.SAXParserFactory.getFeature.

When the underlying XMLReader recognizes the property name but doesn't support the property.

getFromFeaturesback to summary
private boolean getFromFeatures(String name)
getSchemaback to summary
public Schema getSchema()

Overrides javax.xml.parsers.SAXParserFactory.getSchema.

Doc from javax.xml.parsers.SAXParserFactory.getSchema.

Gets the Schema object specified through the setSchema(Schema schema) method.

isNamespaceAwareback to summary
public boolean isNamespaceAware()

Overrides javax.xml.parsers.SAXParserFactory.isNamespaceAware.

Doc from javax.xml.parsers.SAXParserFactory.isNamespaceAware.

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

isValidatingback to summary
public boolean isValidating()

Overrides javax.xml.parsers.SAXParserFactory.isValidating.

Doc from javax.xml.parsers.SAXParserFactory.isValidating.

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

isXIncludeAwareback to summary
public boolean isXIncludeAware()

Overrides javax.xml.parsers.SAXParserFactory.isXIncludeAware.

Doc from javax.xml.parsers.SAXParserFactory.isXIncludeAware.

Get state of XInclude processing.

newSAXParserback to summary
public SAXParser newSAXParser() throws ParserConfigurationException

Implements abstract javax.xml.parsers.SAXParserFactory.newSAXParser.

Creates a new instance of SAXParser using the currently configured factory parameters.

Returns:SAXParser

javax.xml.parsers.SAXParser

Exceptions
ParserConfigurationException:

Doc from javax.xml.parsers.SAXParserFactory.newSAXParser.

if a parser cannot be created which satisfies the requested configuration.

newSAXParserImplback to summary
private SAXParserImpl newSAXParserImpl() throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException

Common code for translating exceptions

putInFeaturesback to summary
private void putInFeatures(String name, boolean value)
setFeatureback to summary
public void setFeature(String name, boolean value) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException

Implements abstract javax.xml.parsers.SAXParserFactory.setFeature.

Sets the particular feature in the underlying implementation of org.xml.sax.XMLReader.

Exceptions
ParserConfigurationException:

Doc from javax.xml.parsers.SAXParserFactory.setFeature.

if a parser cannot be created which satisfies the requested configuration.

SAXNotRecognizedException:

Doc from javax.xml.parsers.SAXParserFactory.setFeature.

When the underlying XMLReader does not recognize the property name.

SAXNotSupportedException:

Doc from javax.xml.parsers.SAXParserFactory.setFeature.

When the underlying XMLReader recognizes the property name but doesn't support the property.

setNamespaceAwareback to summary
public void setNamespaceAware(boolean awareness)

Overrides javax.xml.parsers.SAXParserFactory.setNamespaceAware.

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

setSchemaback to summary
public void setSchema(Schema grammar)

Overrides javax.xml.parsers.SAXParserFactory.setSchema.

Doc from javax.xml.parsers.SAXParserFactory.setSchema.

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 warnings/errors/fatal errors are found by the validator, the parser must handle them as if those errors were found by the parser itself. In other words, if the user-specified org.xml.sax.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 SAX event stream (for example by adding default values that were missing in documents), and a parser is responsible to make sure that the application will receive those modified event stream.

Initially, null is set as the Schema.

This processing will take effect even if the 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 non-null Schema object. Such configuration will cause a SAXException exception when those properties are set on a SAXParser.

Note for implementors

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.

setValidatingback to summary
public void setValidating(boolean validating)

Overrides javax.xml.parsers.SAXParserFactory.setValidating.

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

setXIncludeAwareback to summary
public void setXIncludeAware(boolean state)

Overrides javax.xml.parsers.SAXParserFactory.setXIncludeAware.

Doc from javax.xml.parsers.SAXParserFactory.setXIncludeAware.

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.