Class XmlStringLookup
java.lang.Object
org.apache.commons.text.lookup.AbstractStringLookup
org.apache.commons.text.lookup.AbstractPathFencedLookup
org.apache.commons.text.lookup.XmlStringLookup
- All Implemented Interfaces:
Function<String,String>, UnaryOperator<String>, StringLookup
Looks up values in an XML document in the format
"DocumentPath:XPath".
For example:
"com/domain/document.xml:/path/to/node"
Secure processing is enabled by default and can be overridden with StringLookupFactory.xmlStringLookup(Map, Path...).
- Since:
- 1.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionDefines default XML factory features.Defines default XPath factory features.(package private) static final XmlStringLookupDefines the singleton for this class with secure processing enabled by default.private static final intThe number of key parts.Defines XML factory features.Defines XPath factory features.Fields inherited from class AbstractPathFencedLookup
fenceFields inherited from class AbstractStringLookup
SPLIT_CH, SPLIT_STR -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class AbstractPathFencedLookup
getPathMethods inherited from class AbstractStringLookup
substringAfter, substringAfter, substringAfterLast, toLookupKey, toLookupKeyMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface StringLookup
apply
-
Field Details
-
KEY_PARTS_LEN
private static final int KEY_PARTS_LENThe number of key parts.- See Also:
-
DEFAULT_XPATH_FEATURES
-
DEFAULT_XML_FEATURES
-
INSTANCE
Defines the singleton for this class with secure processing enabled by default.Secure processing is enabled by default and can be overridden with
StringLookupFactory.xmlStringLookup(Map, Path...). -
xPathFactoryFeatures
-
xmlFactoryFeatures
-
-
Constructor Details
-
XmlStringLookup
XmlStringLookup(Map<String, Boolean> xmlFactoryFeatures, Map<String, Boolean> xPathFactoryFeatures, Path... fences) Constructs a new instance.- Parameters:
xmlFactoryFeatures- TheDocumentBuilderFactoryfeatures to set.xPathFactoryFeatures- TheXPathFactoryfeatures to set.- See Also:
-
-
Method Details
-
lookup
Looks up a value for the key in the format"DocumentPath:XPath".For example:
"com/domain/document.xml:/path/to/node"
Secure processing is enabled by default and can be overridden with
StringLookupFactory.xmlStringLookup(Map, Path...).- Parameters:
key- the key to be looked up, may be null.- Returns:
- The value associated with the key.
-