Getting iterated attributes ?Try use the relative XPath expression. So
instead of
/Transaction/@transactionidsender
try
@id
Also instead of
node.selectSingleNode(path).getText()
you can use
node.valueOf(path);
James
-------
http://radio.weblogs.com/0112098/
----- Original Message -----
From: Bingel, Michael
To: '[EMAIL PROTECTED]'
Sent: Monday, December 09, 2002 12:48 PM
Subject: [dom4j-user] Getting iterated attributes ?
Hi there,
I am trying to iterate through sub-nodes and have a little problem.
I get the sub-nodes fine, but I can't access the attributes.
XML:
<TransactionList>
<Transaction id="1"/>
<Transaction id="2"/>
</TransactionList>
SOURCE:
Iterator i =
request.selectNodes("/TransactionList/Transaction").iterator();
while (i.hasNext()) {
Element e = (Element)i.next();
System.out.println("ID=" +
e.selectSingleNode("/Transaction/@transactionidsender").getText());
}
Can someone give me a hint ?
cheers Mike
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user