unable to parse XML in pig
This XPath will look for a tag called &lt;Text&gt; inside a tag called &lt;posthistory&gt;:

XPath(x, 'posthistory/Text');


You want to find the Text attribute of the row tag in posthistory tags.

An XPath something like this will do that: /posthistory/row/@Text

See example here: http://www.xpathtester.com/xpath/bac9874ec344f9d8ebcfb250633aaf65 and click "Test" to see results set.

Learn up on XPath notation for more.