Hi

Whats the use case for using a bundle to expose a namespace. I am not
sure all this is avail during the namespace parsing.

The usual approach is just to define the namespace mapping in the XML
stanza, and then refer to it in your xpath




On Tue, May 8, 2012 at 11:15 AM, PAC Kieffer Guillaume
<guillaume.kief...@panalpina.com> wrote:
> Hi Claus,
>
> I upgraded to 2.8.5 and still the same issue:
> Caused by: org.apache.xpath.domapi.XPathStylesheetDOM3Exception: Prefix must 
> resolve to a namespace: scs
>
> Is it worh trying 2.9.2 ?
> I do not know if the upgrade on ServiceMix would be as smooth as 2.8.4 -> 
> 2.8.5..
>
> Regards,
> Guillaume.
>
> -----Original Message-----
> From: Claus Ibsen [mailto:claus.ib...@gmail.com]
> Sent: Tuesday, May 08, 2012 08:56
> To: users@camel.apache.org
> Subject: Re: OSGi - CAMEL and Custom Namespace
>
> Hi
>
> Have you tried with 2.8.5 version of Camel ?
>
>
> On Mon, May 7, 2012 at 2:34 PM, PAC Kieffer Guillaume
> <guillaume.kief...@panalpina.com> wrote:
>> Hi,
>>
>> I am using Camel (2.8.4) XML DSL on ServiceMix 4.4.1 (OSGi environment)
>> I created a bundle exposing a custom namespace; here is the blueprint file:
>>
>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";>
>>     <service id="myXMLNamespaceHandler"
>>              interface="org.apache.aries.blueprint.NamespaceHandler">
>>         <service-properties>
>>             <entry key="osgi.service.blueprint.namespace" 
>> value="http://www.company.com/xmlns/scs/v1.0.0"/>
>>         </service-properties>
>>         <bean 
>> class="org.apache.xbean.blueprint.context.impl.XBeanNamespaceHandler">
>>             <argument value="http://www.company.com/xmlns/scs/v1.0.0"/>
>>             <argument value="scs.xsd"/>
>>             <argument ref="blueprintBundle"/>
>>             <argument value="META-INF/services/blueprint/xmlns/v1.0.0"/>
>>         </bean>
>>     </service>
>> </blueprint>
>>
>> With
>>
>> <Export-Service>org.apache.aries.blueprint.NamespaceHandler;osgi.service.blueprint.namespace="http://www.company.com/xmlns/scs/v${project.version}";</Export-Service>
>>
>> included in the Manifest.mf file and the XSD files available on the bundle 
>> root.
>> The bundle is started successfully on the environment.
>>
>> My Route blueprint file contains following declaration of CamelContext:
>> <camelContext id="scs-ftp-route" trace="true" 
>> xmlns="http://camel.apache.org/schema/blueprint";
>>                      xmlns:scs="http://www.company.com/xmlns/scs/v1.0.0";>
>>
>> One of my route uses this XPath expression: name(/scs:*)='XXXX'
>> I am getting the following exception while the xpath expression is being 
>> evaluated:
>>
>> org.apache.camel.builder.xml.InvalidXPathExpression: Invalid xpath: 
>> name(/scs:*)='XXXX'. Reason: javax.xml.xpath.XPathExpressionException: 
>> org.apache.xpath.domapi.XPathStylesheetDOM3Exception: Prefix must resolve to 
>> a namespace: scs
>>
>> Referring to 
>> http://camel.465427.n5.nabble.com/fail-filter-XPATH-camel-td476424.html 
>> adding the xmlns declaration on the CamelContext Element is sufficient.
>> But in this case, the namespace handler is customized and deployed on an 
>> OSGi env.
>>
>> Any idea how to solve that issue:
>> Using Namespace aware Xpath within Camel with a custom NamespaceHandler 
>> started and declared as an OSGi Service ?
>>
>> Thanks for your help ,
>>
>> Regards,
>> Guillaume.
>
>
>
> --
> Claus Ibsen
> -----------------
> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
> FuseSource
> Email: cib...@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to