Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi. Struggling with the filter xpath example #19

Closed
davesargrad opened this issue Jan 24, 2020 · 1 comment
Closed

Hi. Struggling with the filter xpath example #19

davesargrad opened this issue Jan 24, 2020 · 1 comment

Comments

@davesargrad
Copy link

davesargrad commented Jan 24, 2020

I'm starting to work through the examples in the book. I've found the filter xpath to be difficult to get working. I've tried several iterations at this point. I've also verified my xpath online.

I've tried several variants (starting with the filter on "test attribute" provided in the book).
image

image

In general, my filter drops all the messages. They make it to the outbox if I eliminate the filter.

Here is a filter that i think should work (checking value of an element rather than an attribute)

The XML (inbox/order4.xml)

<?xml version="1.0" encoding="UTF-8"?>
<person><city>London</city></person>

The route

from("file:data/inbox?noop=true")
                        .log("Received order: ${header.CamelFileName}")
                        .filter().xpath("/person/city='London'")
                        .log("Please process valid order: ${header.CamelFileName}")
                        .to("file:data/outbox");

The output
image

I should see that order4 is procssed and placed in the outbox. Yet it isnt.
image

The online validation using an xpath tester:

image

What am I missing?

@davesargrad
Copy link
Author

davesargrad commented Jan 24, 2020

The following is the whole piece of code. You see the first filters i tried commented out, since they didnt seem to what i expected them to do.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant