title: Extract attribute value in XML using xpath in PIG
body: <p>I have following input XML</p>
  
  <pre><code>&lt;Type&gt;  
      &lt;Source&gt;        
          &lt;TimeStamp&gt;2016-02-19T12:27:06.387Z&lt;/TimeStamp&gt;
          &lt;IPAddress IPVersion="IPv4"&gt;x.xx.xxx.xxx&lt;/IPAddress&gt;
          &lt;Port&gt;64435&lt;/Port&gt;
          &lt;DNS_Name&gt;x.xx.xxx.xxx.range9-27.abc.com&lt;/DNS_Name&gt;
      &lt;/Source&gt;
   &lt;/Type&gt;
  </code></pre>
  
  <p>I'm trying to retrieve all the values from the above tags using below code.</p>
  
  <pre><code>REGISTER piggybank-0.15.0.jar
              DEFINE XPath org.apache.pig.piggybank.evaluation.xml.XPath();
  
          A =  LOAD 'test.xml' using org.apache.pig.piggybank.storage.XMLLoader('Type') as (x:chararray);
          B = FOREACH A GENERATE 
                                 XPath(x, 'Source/TimeStamp')
                                 ,XPath(x, 'Source/IPAddress')
                                 ,XPath(x, 'Source/IPAddress/@IPVersion')
                                 ,XPath(x, 'Source/Port')
                                 ,XPath(x, 'Source/DNS_Name');
  </code></pre>
  
  <p>When I dump B, I get the following output where the value of IPVersion is missing.</p>
  
  <pre><code>(2016-02-19T12:27:06.387Z,x.xx.xxx.xxx,,64435,x.xx.xxx.xxx.range9-27.abc.com) 
  </code></pre>
  
  <p>can anyone please help me to resolve this?</p>