Top Description Fields Constructors Methods
org.apache.commons.text.lookup

pack-priv final Class XmlStringLookup

extends AbstractPathFencedLookup
Class Inheritance
Imports
java.io.InputStream, java.nio.file.Files, .Path, java.util.HashMap, .Map, .Map.Entry, .Objects, javax.xml.XMLConstants, javax.xml.parsers.DocumentBuilderFactory, javax.xml.xpath.XPathFactory, org.apache.commons.lang3.StringUtils, org.w3c.dom.Document

Looks up values in an XML document in the format "DocumentPath:XPath".

For example:

Secure processing is enabled by default and can be overridden with StringLookupFactory#xmlStringLookup(Map, Path...).

Since
1.5

Field Summary

Modifier and TypeField and Description
pack-priv static final Map<String, Boolean>
DEFAULT_XML_FEATURES

Defines default XML factory features.

pack-priv static final Map<String, Boolean>
DEFAULT_XPATH_FEATURES

Defines default XPath factory features.

pack-priv static final XmlStringLookup
INSTANCE

Defines the singleton for this class with secure processing enabled by default.

private static final int
KEY_PARTS_LEN

The number of key parts.

private final Map<String, Boolean>
xmlFactoryFeatures

Defines XML factory features.

private final Map<String, Boolean>
xPathFactoryFeatures

Defines XPath factory features.

Inherited from org.apache.commons.text.lookup.AbstractPathFencedLookup:
fence

Constructor Summary

AccessConstructor and Description
pack-priv
XmlStringLookup(final Map<String, Boolean>
The DocumentBuilderFactory features to set.
xmlFactoryFeatures
,
final Map<String, Boolean>
The XPathFactory features to set.
xPathFactoryFeatures
,
final Path... fences)

Constructs a new instance.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

The value associated with the key.
lookup
(final String
the key to be looked up, may be null.
key
)

Implements org.apache.commons.text.lookup.StringLookup.lookup.

Looks up a value for the key in the format "DocumentPath:XPath".

Inherited from org.apache.commons.text.lookup.AbstractPathFencedLookup:
getPath

Field Detail

DEFAULT_XML_FEATURESback to summary
pack-priv static final Map<String, Boolean> DEFAULT_XML_FEATURES

Defines default XML factory features.

DEFAULT_XPATH_FEATURESback to summary
pack-priv static final Map<String, Boolean> DEFAULT_XPATH_FEATURES

Defines default XPath factory features.

INSTANCEback to summary
pack-priv static final XmlStringLookup 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...).

KEY_PARTS_LENback to summary
private static final int KEY_PARTS_LEN

The number of key parts.

xmlFactoryFeaturesback to summary
private final Map<String, Boolean> xmlFactoryFeatures

Defines XML factory features.

xPathFactoryFeaturesback to summary
private final Map<String, Boolean> xPathFactoryFeatures

Defines XPath factory features.

Constructor Detail

XmlStringLookupback to summary
pack-priv XmlStringLookup(final Map<String, Boolean> xmlFactoryFeatures, final Map<String, Boolean> xPathFactoryFeatures, final Path... fences)

Constructs a new instance.

Parameters
xmlFactoryFeatures:Map<String, Boolean>

The DocumentBuilderFactory features to set.

xPathFactoryFeatures:Map<String, Boolean>

The XPathFactory features to set.

See Also
DocumentBuilderFactory#setFeature(String, boolean), XPathFactory#setFeature(String, boolean)

Method Detail

lookupback to summary
public String lookup(final String key)

Implements org.apache.commons.text.lookup.StringLookup.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:String

the key to be looked up, may be null.

Returns:String

The value associated with the key.

Annotations
@Override