public class XmlFieldExtractor extends Object
Constructor and Description |
---|
XmlFieldExtractor(org.slf4j.Logger soapXmlLogger,
com.google.common.base.Supplier<DocumentBuilder> documentBuilderSupplier,
com.google.common.base.Supplier<XPath> xpathSupplier) |
Modifier and Type | Method and Description |
---|---|
Map<String,String> |
extract(InputStream xml,
String[] fields)
Locates the target fields in the specified XML and uses a wildcard XPath to
identify the first matching node and return it in a map.
|
@Inject public XmlFieldExtractor(org.slf4j.Logger soapXmlLogger, com.google.common.base.Supplier<DocumentBuilder> documentBuilderSupplier, com.google.common.base.Supplier<XPath> xpathSupplier)
public Map<String,String> extract(InputStream xml, String[] fields)
For example, for the xml: <xml><bar>BAR</bar></xml></code>
and
field "bar", this class return a map with key "bar" and value "BAR".
xml
- Stream of XML to process.fields
- List of fields to look for.Copyright © 2018. All Rights Reserved.