This week's book giveaway is in the Android forum.
We're giving away four copies of Learning Java by Building Android Games and have Jean-Marcel Belmont on-line!
See this thread for details.
Win a copy of Learning Java by Building Android Games this week in the Android forum!
  • 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
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Java- XML  RSS feed

 
Greenhorn
Posts: 12
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have an XML which is something like this:



All i want to do is get the queryValue by passing the queryName.
For ex: if I pass "CreateTask" to some function, the return value shoud be "Creating".

I am not sure if the DocumentBuilderFactory and other classes retrieve the value based on name.

Any pointers please?

TIA
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sai,
Yes the DOM parser doesn't do that. You will have to retrieve the "Query" tag elements as a NodeList and then iterate over them to perform search. Also, since the "queryname" and the "queryvalue" tags appear in pairs, you can actually directly retrieve these tags directly by using the getElementsByTabName(..) method and create a HashMap by mapping indices (As I said, since the items appear in pair, the index mapping would work fine).
Thanks
Kshitij
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!