I need flush xml in hashtable and I have with that.
<val>
<camp1>A</camp1>
<camp2>B</camp2>
<camp3>C</camp3>
</val>
<val>
<camp1>D</camp1>
<camp2>
<other>t</other>
</camp2>
<camp3>F</camp3>
</val>
For Example the on hashtable
key=val.camp2.other and value is t
key=val.camp1 and value is A
key=val.camp1 and value is D but this is a second iterate should be key=val[0].camp1
I have a Node and get Xpath use this function but I need get true Xpath
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
public
String getXpath(Node Child)
{
String xpath="";
for(Node parent=Child.getParentNode(); parent!=null;parent=parent.getParentNode())
{
if(!parent.getNodeName().equalsIgnoreCase("#document"))
{
xpath=parent.getNodeName() + xpath;
if(parent.getParentNode()!=null)
{
xpath="/"+xpath;
}
//val/camp1[1]
}
}
return xpath + "/" + Child.getNodeName();
}
[ June 27, 2007: Message edited by: Jose Socola ]