This is a java question, btw.
I'm using xPath and everything works great until I get to the last point where I'm looking at the node set that I've sought and I need to do a really ugly evaluation to see if the node I'm dealing with is of type ELEMENT or TEXT before I can get its value. I was wondering if there's a method along the lines of the one I wrote beneath that will get me the value.
XPathExpression expr = inFeed.getXpath().compile(xPathEx);
Object result = expr.evaluate( rootNode, XPathConstants.NODESET);
NodeList nodeList = (NodeList)result;
ret = "";
for(int i = 0; i< nodeList.getLength() ; i++){
ret += getNodeValue(nodeList.item(i)) + ",";
}
so... see the getNodeValue() method? It gets me the string that's inside that node and if the node happens to not be of type TEXT it goes looking for children and when it finds a TEXT node it returns that.
There MUST be a Node native way to do this that I'm overlooking, right?