Top Description Fields Constructors Methods
com.fasterxml.aalto.sax

public Class SAXParserFactoryImpl

extends SAXParserFactory
Class Inheritance
Imports
javax.xml.parsers.SAXParser, .SAXParserFactory, com.fasterxml.aalto.AaltoInputProperties, org.xml.sax.SAXNotRecognizedException, .SAXNotSupportedException, com.fasterxml.aalto.stax.InputFactoryImpl

This is implementation of the main JAXP SAX factory, and as such acts as the entry point from JAXP.

Note

most of the SAX features are not configurable as of yet. However, effort is made to recognize all existing standard features and properties, to allow using code to figure out existing capabilities automatically.

Field Summary

Modifier and TypeField and Description
pack-priv final InputFactoryImpl

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
getFeature(String
The name of the property to be retrieved.
name
)

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

Returns the particular property requested for in the underlying implementation of org.xml.sax.XMLReader.
public static SAXParserFactory
newInstance()

Hides javax.xml.parsers.SAXParserFactory.newInstance.

Obtains a new instance of a SAXParserFactory.
public SAXParser
newSAXParser()

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

Creates a new instance of a SAXParser using the currently configured factory parameters.
public void
setFeature(String
The name of the feature to be set.
name
,
boolean
The value of the feature to be set.
enabled
)

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

Sets the particular feature in the underlying implementation of org.xml.sax.XMLReader.
public void
setNamespaceAware(boolean
true if the parser produced by this code will provide support for XML namespaces; false otherwise.
awareness
)

Overrides javax.xml.parsers.SAXParserFactory.setNamespaceAware.

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

Overrides javax.xml.parsers.SAXParserFactory.setValidating.

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

Field Detail

mStaxFactoryback to summary
pack-priv final InputFactoryImpl mStaxFactory

Constructor Detail

SAXParserFactoryImplback to summary
public SAXParserFactoryImpl()

Method Detail

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

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

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

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

Parameters
name:String

The name of the property to be retrieved.

Returns:boolean

Value of the requested property.

Annotations
@Override
Exceptions
SAXNotRecognizedException:
When the underlying XMLReader does not recognize the property name.
SAXNotSupportedException:
When the underlying XMLReader recognizes the property name but doesn't support the property.
newInstanceback to summary
public static SAXParserFactory newInstance()

Hides javax.xml.parsers.SAXParserFactory.newInstance.

Doc from javax.xml.parsers.SAXParserFactory.newInstance.

Obtains a new instance of a SAXParserFactory. This method uses the JAXP Lookup Mechanism to determine the SAXParserFactory implementation class to load.

Once an application has obtained a reference to a SAXParserFactory, it can use the factory to configure and obtain parser instances.

Tip for Trouble-shooting

Setting the jaxp.debug system property will cause this method to print a lot of debug messages to System.err about what it is doing and where it is looking at.

If you have problems loading SAXParsers, try:

java -Djaxp.debug=1 YourProgram ....
Returns:SAXParserFactory

A new instance of a SAXParserFactory.

newSAXParserback to summary
public SAXParser newSAXParser()

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

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

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

Returns:SAXParser

A new instance of a SAXParser.

Annotations
@Override
setFeatureback to summary
public void setFeature(String name, boolean enabled) throws SAXNotRecognizedException, SAXNotSupportedException

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

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

Sets the particular feature in the underlying implementation of org.xml.sax.XMLReader. A list of the core features and properties can be found at http://www.saxproject.org/

All implementations are required to support the javax.xml.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 org.xml.sax.ErrorHandler#fatalError(SAXParseException exception). See SAXParser parse methods for handler specification.
  • When the feature is false, the implementation will processing XML according to the XML specifications without regard to possible implementation limits.
Parameters
name:String

The name of the feature to be set.

enabled:boolean

The value of the feature to be set.

Annotations
@Override
Exceptions
SAXNotRecognizedException:
When the underlying XMLReader does not recognize the property name.
SAXNotSupportedException:
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.

Parameters
awareness:boolean

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

Annotations
@Override
setValidatingback to summary
public void setValidating(boolean value)

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.

Parameters
value:boolean

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

Annotations
@Override