• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How to retrieve both Elements & Attributes at the sametime in XPath

 
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi XML Experts,

I would like to find out how to retrieve both the content of element and attribute of nodes at the same time using XPath in Java.. Below is an example of an XML structure:


I would like to stay away from having to use transformation as much as possible due to lack of knowledge in that area.

I would very much appreciated if you could help with achieving XPath searches ( iv ) and ( v ).

This question has been posted on http://forums.sun.com/thread.jspa?threadID=5340927 as well.

Many thanks,

Jack
 
Jack Bush
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I managed to use (i), and then navigate from the elements to the required attributes using the getAttribute() method in JDOM to retreive both values.

Jack
 
Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic