camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmoulliard <cmoulli...@gmail.com>
Subject Re: Xpath Prefix NameSpace Error !
Date Tue, 08 Jul 2008 13:32:20 GMT

This is not an error related to the expression because I have the same error
if I use the syntax //SwInt:Requestor

Remark : as explained If I uncomment Namespaces, the same error is reported
too


James.Strachan wrote:
> 
> BTW are you sure this isn't just a bug in your namespace expression? e.g.
> 
> /SwInt:Requestor
> 
> is not the root element. Try the // hack?
> 
> 2008/7/8 James Strachan <james.strachan@gmail.com>:
>> What happens if you uncommend the Namespaces line? FWIW you have to
>> define namespace prefixes to use XPath effectively with namespaced XML
>>
>> 2008/7/8 cmoulliard <cmoulliard@gmail.com>:
>>>
>>> Hi,
>>>
>>> When I try to make a XPATH search on an XML document, I receive the
>>> following error :
>>>
>>> "xpath prefix must resolve to a namespace : SwInt"
>>>
>>> Here is a snapshot of the XML file and my code :
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <SwInt:HandleRequest
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>                     xmlns:SwInt="urn:swift:snl:ns:SwInt"
>>>                     xmlns:Sw="urn:swift:snl:nsSw">
>>> <SwInt:RequestHandle>
>>> <SwInt:RequestDescriptor>
>>>
>>> <SwInt:SwiftRequestRef>SNL31681-2007-06-01T12:27:31.8052.000006Z</SwInt:SwiftRequestRef>
>>>
>>> <SwInt:SwiftRef>swi00006-2007-06-01T12:27:32.20833.17813791Z</SwInt:SwiftRef>
>>>        <SwInt:NonRep>
>>>                        <SwInt:NRType>SVCMAND</SwInt:NRType>
>>>        </SwInt:NonRep>
>>>        <SwInt:ValidationDescriptor>
>>>                        <SwInt:ValResult>Success</SwInt:ValResult>
>>>        </SwInt:ValidationDescriptor>
>>>        <Sw:SnFOutputInfo>
>>>           
>>> <Sw:SnFSessionId>frimlull_fundstest!p:p:722950</Sw:SnFSessionId>
>>>                <Sw:SnFOutputSeq>392</Sw:SnFOutputSeq>
>>>                <Sw:DeliveryTime>2007-06-01T12:27:34Z</Sw:DeliveryTime>
>>>        </Sw:SnFOutputInfo>
>>>        <SwInt:MRRResult>
>>>            <SwInt:SNLId>snl31681</SwInt:SNLId>
>>>            <SwInt:SNLEP>snl_ap2</SwInt:SNLEP>
>>>        </SwInt:MRRResult>
>>> </SwInt:RequestDescriptor>
>>> <SwInt:RequestHeader>
>>>           
>>> <SwInt:Requestor>ou=funds,o=FETALULL,o=swift</SwInt:Requestor>
>>>                       
>>> <SwInt:Responder>ou=funds,o=frimlull,o=swift</SwInt:Responder>
>>>                        <SwInt:Service>swift.if.ia!p</SwInt:Service>
>>>                       
>>> <SwInt:RequestType>setr.007.001.03</SwInt:RequestType>
>>>                        <SwInt:Priority>Normal</SwInt:Priority>
>>>                       
>>> <SwInt:RequestRef>627.000734.0001</SwInt:RequestRef>
>>> </SwInt:RequestHeader>
>>> <SwInt:RequestPayload>
>>>                        <AppHdr xmlns="urn:swift:xsd:$ahV10">
>>>                                <MsgName>setr.007.001.03</MsgName>
>>>                                <MsgRef>MINTAD01-10SR</MsgRef>
>>>                               
>>> <CrDate>2007-05-30T16:02:04+02:00</CrDate>
>>>                        </AppHdr>
>>> ...
>>> </SwInt:RequestPayload>
>>> </SwInt:RequestHandle>
>>> </SwInt:HandleRequest>
>>>
>>> public class AuthenticateCompany extends RouteBuilder {
>>>
>>>        @Override
>>>        public void configure() {
>>>
>>>        //Namespaces ns = new Namespaces("SwInt",
>>> "urn:swift:snl:ns:SwInt");
>>>
>>>               
>>> errorHandler(deadLetterChannel("seda:errors").maximumRedeliveries(1)
>>>                                .useExponentialBackOff());
>>>
>>>                from("file:///c:/temp/test").choice()
>>>
>>> .when().xpath("/SwInt:Requestor/text()='ou=funds,o=FETALULL,o=swift'").setHeader("companyName").xpath("/SwInt:Requestor/text()",
>>> String.class).to("activemq:queue:swift.in.queue")
>>>                .otherwise().to("activemq:queue:rejectedmessages.queue");
>>>
>>>
>>>        }
>>>
>>> }
>>>
>>> Remark : the code does not work too if I define Namespaces ns
>>>
>>> Regards,
>>>
>>> Charles
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Xpath-Prefix-NameSpace-Error-%21-tp18338783s22882p18338783.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> James
>> -------
>> http://macstrac.blogspot.com/
>>
>> Open Source Integration
>> http://open.iona.com
>>
> 
> 
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://open.iona.com
> 
> 

-- 
View this message in context: http://www.nabble.com/Xpath-Prefix-NameSpace-Error-%21-tp18338783s22882p18339337.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message