Class ParserConfigurationSettings
- java.lang.Object
-
- org.htmlunit.cyberneko.xerces.util.ParserConfigurationSettings
-
- All Implemented Interfaces:
XMLComponentManager
- Direct Known Subclasses:
HTMLConfiguration
public class ParserConfigurationSettings extends java.lang.Object implements XMLComponentManager
This class implements the basic operations for managing parser configuration features and properties. This utility class can be used as a base class for parser configurations or separately to encapsulate a number of parser settings as a component manager.This class can be constructed with a "parent" settings object (in the form of an
XMLComponentManager
) that allows parser configuration settings to be "chained" together.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.HashMap<java.lang.String,java.lang.Boolean>
fFeatures_
Features.private java.util.HashMap<java.lang.String,java.lang.Object>
fProperties_
Properties.private java.util.ArrayList<java.lang.String>
fRecognizedFeatures_
Recognized features.private java.util.ArrayList<java.lang.String>
fRecognizedProperties_
Recognized properties.
-
Constructor Summary
Constructors Constructor Description ParserConfigurationSettings()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRecognizedFeatures(java.lang.String[] featureIds)
Allows a parser to add parser specific features to be recognized and managed by the parser configuration.void
addRecognizedProperties(java.lang.String[] propertyIds)
Allows a parser to add parser specific properties to be recognized and managed by the parser configuration.protected void
checkFeature(java.lang.String featureId)
Check a feature.protected void
checkProperty(java.lang.String propertyId)
Check a property.boolean
getFeature(java.lang.String featureId)
java.lang.Object
getProperty(java.lang.String propertyId)
void
setFeature(java.lang.String featureId, boolean state)
Set the state of a feature.void
setProperty(java.lang.String propertyId, java.lang.Object value)
setProperty
-
-
-
Field Detail
-
fRecognizedProperties_
private final java.util.ArrayList<java.lang.String> fRecognizedProperties_
Recognized properties.
-
fProperties_
private final java.util.HashMap<java.lang.String,java.lang.Object> fProperties_
Properties.
-
fRecognizedFeatures_
private final java.util.ArrayList<java.lang.String> fRecognizedFeatures_
Recognized features.
-
fFeatures_
private final java.util.HashMap<java.lang.String,java.lang.Boolean> fFeatures_
Features.
-
-
Method Detail
-
addRecognizedFeatures
public void addRecognizedFeatures(java.lang.String[] featureIds)
Allows a parser to add parser specific features to be recognized and managed by the parser configuration.- Parameters:
featureIds
- An array of the additional feature identifiers to be recognized.
-
setFeature
public void setFeature(java.lang.String featureId, boolean state) throws XMLConfigurationException
Set the state of a feature.Set the state of any feature in a SAX2 parser. The parser might not recognize the feature, and if it does recognize it, it might not be able to fulfill the request.
- Parameters:
featureId
- The unique identifier (URI) of the feature.state
- The requested state of the feature (true or false).- Throws:
XMLConfigurationException
- If the requested feature is not known.
-
addRecognizedProperties
public void addRecognizedProperties(java.lang.String[] propertyIds)
Allows a parser to add parser specific properties to be recognized and managed by the parser configuration.- Parameters:
propertyIds
- An array of the additional property identifiers to be recognized.
-
setProperty
public void setProperty(java.lang.String propertyId, java.lang.Object value) throws XMLConfigurationException
setProperty- Parameters:
propertyId
- the property idvalue
- the value- Throws:
XMLConfigurationException
- If the requested feature is not known.
-
getFeature
public boolean getFeature(java.lang.String featureId) throws XMLConfigurationException
- Specified by:
getFeature
in interfaceXMLComponentManager
- Parameters:
featureId
- The feature identifier.- Returns:
- the state of a feature.
- Throws:
XMLConfigurationException
- Thrown on configuration error.
-
getProperty
public java.lang.Object getProperty(java.lang.String propertyId) throws XMLConfigurationException
- Specified by:
getProperty
in interfaceXMLComponentManager
- Parameters:
propertyId
- The property identifier.- Returns:
- the value of a property.
- Throws:
XMLConfigurationException
- Thrown on configuration error.
-
checkFeature
protected void checkFeature(java.lang.String featureId) throws XMLConfigurationException
Check a feature. If feature is known and supported, this method simply returns. Otherwise, the appropriate exception is thrown.- Parameters:
featureId
- The unique identifier (URI) of the feature.- Throws:
XMLConfigurationException
- If the requested feature is not known.
-
checkProperty
protected void checkProperty(java.lang.String propertyId) throws XMLConfigurationException
Check a property. If the property is known and supported, this method simply returns. Otherwise, the appropriate exception is thrown.- Parameters:
propertyId
- The unique identifier (URI) of the property being set.- Throws:
XMLConfigurationException
- If the requested feature is not known.
-
-