• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javax.xml Flush XML in hashtable

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic