It might be helpful if you provided simple sample input <span style="font-style: italic;">and</span> output. I honestly don't follow what it is you want to do; especially confusing (to me at least) is why the lookup and id attributes (for KEYs elements) and the name and id attributes (for Area elements) have the same values.
<br><br>In your code, where is the getSingleElementbyXPath() method defined?<br><br><br><div><span class="gmail_quote">On 11/27/06, <b class="gmail_sendername"><a href="mailto:Power_PC@gmx.net">Power_PC@gmx.net</a></b> <
<a href="mailto:Power_PC@gmx.net">Power_PC@gmx.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>my problem is to resolve references to other xml-tags. Here is my xml file:
<br><br><br><Project><br> <KEYs name="host" id="23" lookup="/Project/Area/[@name=''YES']" id="/ Project/Area/[@name=''YES']" /><br> <KEYs name="server" id="404" lookup="/Project/Area/[@name=''XOR']" id="/Project/Area/[@name=''XOR']" />
<br>...<br><br><Area name="YES" id='"YES"'/><br><Area name="XOR" id='"XOR"'/><br>...<br><br></Project><br><br>i want to resolve the references - after importing the file i want to show:
<br>...lookup= and here should be the value of the references - a pointer should go to Project--Area--name--yes, this mean in the tag area where name is yes and id is yes, so finally the xml file should have the resolved value. i have tried with xpath and saxbuilder, but it doesnt work: here my codesample:
<br><br><br>...<br> public static void main(String[] args) {<br><br> SAXBuilder builder = new SAXBuilder();<br> try {<br> xmlfile =
builder.build( new File("sample/xdstrainig.xml"));<br>getRoot = xmlfile.getRootElement();<br>allvalue = getSingleElementbyXPath("/Project/KEYs[@name='host']");<br>List mylist = getRoot.getChildren("KEYs");
<br>Iterator iter = mylist.iterator();<br>Element e;<br>while(iter.hasNext() {<br> e = (Element) iter.next();<br> String stringName = e.getName();<br> Element e2 = (Element) XPath.selectSingleNode(getRoot, "/Project/KEYs/" +stringName);
<br><br>...<br>but how to resolve the references? I think with getSingleElementbyXPath(), but how can i do this??<br>THX for any suggestions!!!!!!<br>Kind regards,<br>Jack<br>--<br>"Ein Herz für Kinder" - Ihre Spende hilft! Aktion:
<a href="http://www.deutschlandsegelt.de">www.deutschlandsegelt.de</a><br>Unser Dankeschön: Ihr Name auf dem Segel der 1. deutschen America's Cup-Yacht!<br>_______________________________________________<br>To control your jdom-interest membership:
<br><a href="http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com">http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com</a><br></blockquote></div><br>