Manning's Countdown to 2014
. Use discount code crdotd14 all month for 50% off every deal.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
how to retrieve attribute value of a node
Klament J. Kruoghst
Joined: Oct 24, 2008
May 10, 2011 13:49:49
Hi there, I need to be able to see and modify an xml value i'm reading.
I'm trying to use import org.apache.xpath.XPathAPI but if there's a better library let me know.
I used to be able to do so using xpath when the xml structure was:
<root> <employeeA>jones</employeeA> <employeeB>smith</employeeB> </root>
by using /root/employeeA/text() to get "jones" but now the xml structure has changed to the following:
<root> <node1> <node2> <employees name="employeeA" value="jones"/> <employees name="employeeB" value="smith"/> </node2> </node1> </root>
I've tried: /root/node1/node2/employees[@name='employeeA'] but it doesn't work because I need the value of the other property, how do I use xpath to modify the value when it is set as an attribute!
Thanks in advanced
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: how to retrieve attribute value of a node
Help parse using JAXP
Resolving includes in XML
Clustering on JBoss3.2+ & 4+
Java and Xml
Replicate XML Node using XSL
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013