com.google.api.ads.adwords.lib.utils
Class XmlFieldExtractor

java.lang.Object
  extended by com.google.api.ads.adwords.lib.utils.XmlFieldExtractor

public class XmlFieldExtractor
extends Object

Utility class to extract fields from XML.

Author:
Kevin Winter

Constructor Summary
XmlFieldExtractor()
          Constructor.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlFieldExtractor

public XmlFieldExtractor()
Constructor.

Method Detail

extract

public 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. 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".

Parameters:
xml - Stream of XML to process
fields - List of fields to look for.


Copyright © 2012. All Rights Reserved.