• 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

MbElement.evaluateXPath(String) - what am I doing wrong with it.

 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alright, so let's say I have the following XML fragment as part of a SOAP message:


Now, I have the following code:


The inputBody is in effect the MbElement representing the SOAP node.

Now, I can do the following:


and I will wind up with firstDetail being an MbElement that represents the first DETAILS element - whose value is "M5-100"

However, if I do this:


I would EXPECT that details is a List<MbElement> with a size of 3, with each one being a DETAILS element. However, it comes back as an empty list.


Oddly, I CAN do this:

and it will work - I get a List<MbElement> of size 1, and that one item is the Body MbElement. But any deeper in the hierarchy, and it just gives me an empty list.

So, why is that? What am I doing wrong that I am not getting a 3-element List<MbElement> back?
 
Ranch Hand
Posts: 734
7
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have to make sure BASE, ORDER, DETAILS all of them are not in any namespace, ie, they are all in null namespace. Since you say SOAP node, SOAP message etc etc, it seems unlikely that they are.

Here is a simple test. Use this line instead for a quick test.

If that returns a list of size 3, you then identify their namespace and use the MbXPath to set the xpath up properly with prefix(es) corresponding to their namespace(s).
 
Joe Vahabzadeh
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you again for your help - I had "almost" discovered that same issue - that it was a namespace problem, but was still working it out.... going to change my code now to account for this.
 
reply
    Bookmark Topic Watch Topic
  • New Topic