Package org.apache.commons.text.lookup
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 org.apache.commons.text.lookup.AbstractPathFencedLookup
fenceFields inherited from class org.apache.commons.text.lookup.AbstractStringLookup
SPLIT_CH, SPLIT_STR -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.commons.text.lookup.AbstractPathFencedLookup
getPathMethods inherited from class org.apache.commons.text.lookup.AbstractStringLookup
substringAfter, substringAfter, substringAfterLast, toLookupKey, toLookupKeyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.text.lookup.StringLookup
apply
-
Field Details
-
KEY_PARTS_LEN
private static final int KEY_PARTS_LENThe number of key parts.- See Also:
-
DEFAULT_XPATH_FEATURES
Defines default XPath factory features. -
DEFAULT_XML_FEATURES
Defines default XML factory 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
Defines XPath factory features. -
xmlFactoryFeatures
Defines XML factory features.
-
-
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.
-