You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by bhusted <bh...@yahoo.com> on 2009/11/02 22:11:13 UTC

Use sys.property in xpath filter

Is it possible to refer to a Java System property in a camel:xpath filter?

For example:

<camel:filter>
   <camel:xpath>/myns:SomeTag = ${sys.SomeSystemProp}</camel:xpath>
</camel:filter>


Any suggestions if this isn't possible for combining xpath and expression
language would be REALLY helpful.

Thanks
-- 
View this message in context: http://old.nabble.com/Use-sys.property-in-xpath-filter-tp26157832p26157832.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Use sys.property in xpath filter

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Nov 10, 2009 at 3:30 PM, bhusted <br...@gmail.com> wrote:
>
> I reviewed that page extensively and found a reference to using the namespace
>
> http://camel.apache.org/xml/variables/system-properties
>
> What I am really looking for is an example that shows if it is possible to
> use a variable in the Xpath expression.
>
> So in Java I do the following:  System.setProperty("MY_PROP", "MY_VALUE");
>
> Then I define the system-property namespace and give it a prefix of "sys".
>
> What would the resulting Xpath expression look like?  Below are the examples
> I tried with no luck.
>
> <camel:filter>
>   <camel:xpath>/myns:SomeTag = ${sys.MY_PROP}</camel:xpath>
> </camel:filter>
>
> AND
>
> <camel:filter>
>   <camel:xpath>/myns:SomeTag = sys:MY_PROP</camel:xpath>
> </camel:filter>
>
>

Hi

Do you mind putting together a small camel route that tries to filter
using xpath with that system property.
And provide a XML document that passed and one that does not.

Then we can use that for unit test to see if there is a gap in Camel.

Create a ticket in JIRA about this and attach the files there.



>
>
>
> Claus Ibsen-2 wrote:
>>
>> Hi
>>
>> See this wiki page
>> http://camel.apache.org/xpath
>>
>> that may help a bit.
>>
>>
>>
>> On Mon, Nov 2, 2009 at 10:11 PM, bhusted <bh...@yahoo.com> wrote:
>>>
>>> Is it possible to refer to a Java System property in a camel:xpath
>>> filter?
>>>
>>> For example:
>>>
>>> <camel:filter>
>>>   <camel:xpath>/myns:SomeTag = ${sys.SomeSystemProp}</camel:xpath>
>>> </camel:filter>
>>>
>>>
>>> Any suggestions if this isn't possible for combining xpath and expression
>>> language would be REALLY helpful.
>>>
>>> Thanks
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Use-sys.property-in-xpath-filter-tp26157832p26157832.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Use-sys.property-in-xpath-filter-tp26157832p26284380.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Use sys.property in xpath filter

Posted by bhusted <br...@gmail.com>.
I reviewed that page extensively and found a reference to using the namespace

http://camel.apache.org/xml/variables/system-properties

What I am really looking for is an example that shows if it is possible to
use a variable in the Xpath expression.

So in Java I do the following:  System.setProperty("MY_PROP", "MY_VALUE");

Then I define the system-property namespace and give it a prefix of "sys".  

What would the resulting Xpath expression look like?  Below are the examples
I tried with no luck.

<camel:filter>
   <camel:xpath>/myns:SomeTag = ${sys.MY_PROP}</camel:xpath>
</camel:filter>

AND

<camel:filter>
   <camel:xpath>/myns:SomeTag = sys:MY_PROP</camel:xpath>
</camel:filter>





Claus Ibsen-2 wrote:
> 
> Hi
> 
> See this wiki page
> http://camel.apache.org/xpath
> 
> that may help a bit.
> 
> 
> 
> On Mon, Nov 2, 2009 at 10:11 PM, bhusted <bh...@yahoo.com> wrote:
>>
>> Is it possible to refer to a Java System property in a camel:xpath
>> filter?
>>
>> For example:
>>
>> <camel:filter>
>>   <camel:xpath>/myns:SomeTag = ${sys.SomeSystemProp}</camel:xpath>
>> </camel:filter>
>>
>>
>> Any suggestions if this isn't possible for combining xpath and expression
>> language would be REALLY helpful.
>>
>> Thanks
>> --
>> View this message in context:
>> http://old.nabble.com/Use-sys.property-in-xpath-filter-tp26157832p26157832.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://old.nabble.com/Use-sys.property-in-xpath-filter-tp26157832p26284380.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Use sys.property in xpath filter

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

See this wiki page
http://camel.apache.org/xpath

that may help a bit.



On Mon, Nov 2, 2009 at 10:11 PM, bhusted <bh...@yahoo.com> wrote:
>
> Is it possible to refer to a Java System property in a camel:xpath filter?
>
> For example:
>
> <camel:filter>
>   <camel:xpath>/myns:SomeTag = ${sys.SomeSystemProp}</camel:xpath>
> </camel:filter>
>
>
> Any suggestions if this isn't possible for combining xpath and expression
> language would be REALLY helpful.
>
> Thanks
> --
> View this message in context: http://old.nabble.com/Use-sys.property-in-xpath-filter-tp26157832p26157832.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus