• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

XPath Expression doubt

 
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello There!

It's a pleasure to be posting here in the XML Forum, and well, I have a problem I can't figure out on my own, So I hope somebody can Help Me.

Here's the deal:

I need to correct an XPath expression I'm building so that it selects ALL the FIELD elements in the Following XML:

<?xml version="1.0" standalone="yes"?>
<GROUP ID="060451" Name="Customer Information Enquiry">
<TX>
<FIELD Format="X(17)" ID="DefaultString1" />
<FIELD Format="XX" ID="DefaultString2" />
<FIELD Format="9(5)" ID="DefInteger1" />
</TX>
</GROUP>

So far my expression looks like this:

/GROUP/TX/FIELD/@ID

But it only CAPTURES the First FIELD element...
To clarify, I use this snippet:


And it only prints out DefaultString1, and I need to get it to print:
DefaultString1
DefaultString2
DefInteger1

like in a loop, so that I can store each value in a String array.

Could anybody Please help Me, I'm really in need... I have tried many different ways to make it work, but I haven't been successful yet.

I wish good luck to everyone reading this post,
Best Regards,
Jose
 
Jose Campana
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there !

Luckily I found the solution to this one!

See you next time Guys !

Best Regards!,

Jose
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jose:
Luckily I found the solution to this one!



Thats great. It will be nice if you can also post the solution for the benefit of people reading your post.
 
He does not suffer fools gladly. But this tiny ad does:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic