Choice with an xquery

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

Choice with an xquery

Thomas Hehl
This: says that I can use an
xquery in a predicate, but I can't find an example.

My message coming back contains a status tag. I want to check it for
"OK" to make sure it processed correctly. Here's what I wrote to make
sure the concept was sound.

                         .transform().xquery("/status", String.class)

But this destroys the entire message. I would like something like:
body().xquery("/status", String.class).isEqualTo("OK").

I could always do a contains, but two letters is a little likely to
appear in the string. I might try a regex if this won't work, but wanted
to try first.


Reply | Threaded
Open this post in threaded view

Re: Choice with an xquery

arno noordover
As seen in you should be able to do something like
Namespaces ns = new Namespaces("c", "");

        filter().xquery("/c:person[@name='James']", ns).
when you replace this example with:
you more or less should be up and running