Package com.helger.xml.serialize.read
Class SAXReaderSettings
java.lang.Object
com.helger.xml.serialize.read.SAXReaderSettings
- All Implemented Interfaces:
com.helger.commons.lang.ICloneable<SAXReaderSettings>,IBaseXMLReaderSettings,ISAXReaderSettings
@NotThreadSafe
public class SAXReaderSettings
extends Object
implements ISAXReaderSettings, com.helger.commons.lang.ICloneable<SAXReaderSettings>
SAX reader settings
- Author:
- Philip Helger
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorSAXReaderSettings(ISAXReaderSettings aOther) Copy constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyToSAXReader(XMLReader aParser) Apply all settings of this object onto the specified XMLReader objectstatic SAXReaderSettingsCreate a clone of the passed settings, depending on the parameter.com.helger.commons.callback.CallbackList<com.helger.commons.callback.exception.IExceptionCallback<Throwable>> com.helger.commons.collection.impl.ICommonsMap<EXMLParserFeature, Boolean> com.helger.commons.collection.impl.ICommonsMap<EXMLParserProperty, Object> getClone()getFeatureValue(EXMLParserFeature eFeature) Get the value of the specified parser featuregetPropertyValue(EXMLParserProperty eProperty) Get the value of the specified parser propertybooleanbooleanbooleanfinal SAXReaderSettingsfinal SAXReaderSettingsfinal SAXReaderSettingsremoveFeature(EXMLParserFeature eFeature) final SAXReaderSettingsremoveFeatures(EXMLParserFeature... aFeatures) final SAXReaderSettingsremovePropertyValue(EXMLParserProperty eProperty) booleanCheck if the current settings require a separateXMLReaderor if a pooled default object can be used.final SAXReaderSettingssetContentHandler(ContentHandler aContentHandler) final SAXReaderSettingssetCustomSAXParserFactory(SAXParserFactory aCustomSAXParserFactory) final SAXReaderSettingssetDeclarationHandler(DeclHandler aDeclHandler) final SAXReaderSettingssetDTDHandler(DTDHandler aDTDHandler) final SAXReaderSettingssetEntityResolver(EntityResolver aEntityResolver) final SAXReaderSettingssetErrorHandler(ErrorHandler aErrorHandler) final SAXReaderSettingssetFeatureValue(EXMLParserFeature eFeature, boolean bValue) final SAXReaderSettingssetFeatureValue(EXMLParserFeature eFeature, Boolean aValue) final SAXReaderSettingssetFeatureValues(Map<EXMLParserFeature, Boolean> aValues) Add multiple XML parser features at once.final SAXReaderSettingssetLexicalHandler(LexicalHandler aLexicalHandler) final SAXReaderSettingssetPropertyValue(EXMLParserProperty eProperty, Object aPropertyValue) final SAXReaderSettingssetPropertyValues(Map<EXMLParserProperty, ?> aProperties) final SAXReaderSettingssetRequiresNewXMLParserExplicitly(boolean bRequiresNewXMLParserExplicitly) toString()
-
Constructor Details
-
SAXReaderSettings
public SAXReaderSettings()Default constructor -
SAXReaderSettings
Copy constructor- Parameters:
aOther- the object to copy the settings from. May not benull.
-
-
Method Details
-
getEntityResolver
- Specified by:
getEntityResolverin interfaceIBaseXMLReaderSettings- Returns:
- The special entity resolver to be used. May be
null.
-
setEntityResolver
-
getDTDHandler
- Specified by:
getDTDHandlerin interfaceISAXReaderSettings- Returns:
- The special DTD handler to be used. May be
null.
-
setDTDHandler
-
getContentHandler
- Specified by:
getContentHandlerin interfaceISAXReaderSettings- Returns:
- The special content handler to be used. May be
null.
-
setContentHandler
-
getErrorHandler
- Specified by:
getErrorHandlerin interfaceIBaseXMLReaderSettings- Returns:
- A special error handler to be used or
nullif no special error handler is needed.
-
setErrorHandler
-
getLexicalHandler
- Specified by:
getLexicalHandlerin interfaceISAXReaderSettings- Returns:
- The special lexical handler to be used. May be
null.
-
setLexicalHandler
-
getDeclarationHandler
- Specified by:
getDeclarationHandlerin interfaceISAXReaderSettings- Returns:
- The special DTD declaration event handler to be used. May be
null.
-
setDeclarationHandler
-
hasAnyProperties
public boolean hasAnyProperties()- Specified by:
hasAnyPropertiesin interfaceIBaseXMLReaderSettings- Returns:
trueif at least one parser property is defined
-
getPropertyValue
Description copied from interface:IBaseXMLReaderSettingsGet the value of the specified parser property- Specified by:
getPropertyValuein interfaceIBaseXMLReaderSettings- Parameters:
eProperty- The property to use. May benull.- Returns:
nullif no such property was found.
-
getAllPropertyValues
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsMap<EXMLParserProperty,Object> getAllPropertyValues()- Specified by:
getAllPropertyValuesin interfaceIBaseXMLReaderSettings- Returns:
- A copy of all contained parser property values. Never
null.
-
setPropertyValue
@Nonnull public final SAXReaderSettings setPropertyValue(@Nonnull EXMLParserProperty eProperty, @Nullable Object aPropertyValue) -
setPropertyValues
@Nonnull public final SAXReaderSettings setPropertyValues(@Nullable Map<EXMLParserProperty, ?> aProperties) -
removePropertyValue
-
removeAllPropertyValues
-
getLocale
- Specified by:
getLocalein interfaceIBaseXMLReaderSettings- Returns:
- The locale to be used for error messages. By default it is
nulland therefore the XML parser will use the system default locale.
-
setLocale
-
hasAnyFeature
public boolean hasAnyFeature()- Specified by:
hasAnyFeaturein interfaceIBaseXMLReaderSettings- Returns:
trueif at least one parser feature is defined,falseif not
-
getFeatureValue
Description copied from interface:IBaseXMLReaderSettingsGet the value of the specified parser feature- Specified by:
getFeatureValuein interfaceIBaseXMLReaderSettings- Parameters:
eFeature- The feature to search. May benull.- Returns:
nullif this feature is undefined.
-
getAllFeatureValues
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsMap<EXMLParserFeature,Boolean> getAllFeatureValues()- Specified by:
getAllFeatureValuesin interfaceIBaseXMLReaderSettings- Returns:
- A copy of all defined parser features at the associated values.
-
setFeatureValue
@Nonnull public final SAXReaderSettings setFeatureValue(@Nonnull EXMLParserFeature eFeature, boolean bValue) -
setFeatureValue
@Nonnull public final SAXReaderSettings setFeatureValue(@Nonnull EXMLParserFeature eFeature, @Nullable Boolean aValue) -
setFeatureValues
@Nonnull public final SAXReaderSettings setFeatureValues(@Nullable Map<EXMLParserFeature, Boolean> aValues) Add multiple XML parser features at once.- Parameters:
aValues- The values to be added. May benull.- Returns:
- this for chaining
-
removeFeature
-
removeFeatures
-
removeAllFeatures
-
requiresNewXMLParser
public boolean requiresNewXMLParser()Description copied from interface:ISAXReaderSettingsCheck if the current settings require a separateXMLReaderor if a pooled default object can be used.- Specified by:
requiresNewXMLParserin interfaceIBaseXMLReaderSettings- Specified by:
requiresNewXMLParserin interfaceISAXReaderSettings- Returns:
trueif a separateXMLReaderis required,falseif not.
-
exceptionCallbacks
@Nonnull @ReturnsMutableObject public com.helger.commons.callback.CallbackList<com.helger.commons.callback.exception.IExceptionCallback<Throwable>> exceptionCallbacks()- Specified by:
exceptionCallbacksin interfaceIBaseXMLReaderSettings- Returns:
- A special exception handler to be used. Never
null.
-
getCustomSAXParserFactory
- Specified by:
getCustomSAXParserFactoryin interfaceISAXReaderSettings- Returns:
- A custom SAX parser factory. This is only needed to work around some of the default SAXParserFactory configuration cannot be applied.
-
setCustomSAXParserFactory
@Nonnull public final SAXReaderSettings setCustomSAXParserFactory(@Nullable SAXParserFactory aCustomSAXParserFactory) -
isRequiresNewXMLParserExplicitly
public boolean isRequiresNewXMLParserExplicitly()- Specified by:
isRequiresNewXMLParserExplicitlyin interfaceISAXReaderSettings- Returns:
trueif a new XML parser is explicitly required for this instance.
-
setRequiresNewXMLParserExplicitly
@Nonnull public final SAXReaderSettings setRequiresNewXMLParserExplicitly(boolean bRequiresNewXMLParserExplicitly) -
getClone
- Specified by:
getClonein interfacecom.helger.commons.lang.ICloneable<SAXReaderSettings>
-
applyToSAXReader
Description copied from interface:ISAXReaderSettingsApply all settings of this object onto the specified XMLReader object- Specified by:
applyToSAXReaderin interfaceISAXReaderSettings- Parameters:
aParser- The XML reader to apply the settings onto. May not benull.
-
toString
-
createCloneOnDemand
Create a clone of the passed settings, depending on the parameter. If the parameter isnulla new emptySAXReaderSettingsobject is created, otherwise a copy of the parameter is created.- Parameters:
aOther- The parameter to be used. May benull.- Returns:
- Never
null.
-