Still having problems with servicemix-drools and namespaces.
I am passing in the namespace context with the following:
<drools:namespace-context id="nxContext">
<drools:namespaces>
<drools:namespace prefix="my">urn:my:ns</drools:namespace>
</drools:namespaces>
</drools:namespace-context>
When my rules file tries to use xpath as follows
eval( in.xpath("/my:invoice/item/quantity > 10"))
I get the following error:
TransformerException: Extra illegal tokens: 'urn:my:ns', ':', 'invoice'
Any ideas would be appreciated.
Thanks,
Mike
Mike Wagner wrote:
>
> Should have been ServiceMix version 3.3.1.17
>
>
> Mike Wagner wrote:
>>
>> Trying to use namespaces in xpath expressions within servicemix-drools
>> doesn't seem to recognize the namespaces. I saw a bug fix was made for
>> this in 3.1 but still doesn't seem to work for me.
>>
>> for example XML:
>>
>> <invoice xmlns="urn:my:ns">
>> <item>
>> <name>Pen</name>
>> <quantity>10</quantity>
>> </item>
>> <item>
>> <name>Paper</name>
>> <quantity>100</quantity>
>> </item>
>> </invoice>
>>
>>
>> Drools file
>> router.drl
>>
>> rule test
>> when
>> $me : Exchange(status == Exchange.ACTIVE, $in : in != null)
>>
>> eval($in.xpath("/invoice[namespace-uri='urn:my:ns']/item[1]/quantity >
>> 5")
>> then
>> ...
>>
>>
>> this evaluation returns false, but if I remove the namespace from the XML
>> and replace the eval with the following it returns true, as expected.
>>
>> eval($in.xpath("/invoice/item[1]/quantity > 5")
>>
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/Xpath-with-Namespaces-in-servicemix-drools-SMX-v3.3.17-tp23565332p23598321.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.