• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to use XpathAPI to select a list of Node ?

 
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<Department>
<Name>Chemistry</Name>
<Address>1 Main Campus Rd</Address>
<Phone>1-800-200-3909</Phone>
...
...
</Department>


What I need is to get the String content for "Name", "Address", "Phone", etc. One way is to
****
// get "Department" element first, let's assume it is done and passed as "departmentElement" then
XpathAPI.selectSingleNode(departmentElement, "./Name");
XpathAPI.selectSingleNode(departmentElement, "./Phone");
...
..
****
The problem is I have to do Xpath for many times if I have *many* sub elements.

Is there a way I can get all the sub elements at one (use XpathAPI once), and then get string values for "Name", "Address" easily ?

Thanks.
 
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think './*' should work.
[ October 19, 2006: Message edited by: Sameer Jamal ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic