Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 83541C081 for ; Fri, 1 Nov 2013 09:20:08 +0000 (UTC) Received: (qmail 53845 invoked by uid 500); 1 Nov 2013 09:20:07 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 53522 invoked by uid 500); 1 Nov 2013 09:20:01 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 53511 invoked by uid 99); 1 Nov 2013 09:19:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Nov 2013 09:19:59 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [98.138.229.27] (HELO nm34.bullet.mail.ne1.yahoo.com) (98.138.229.27) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Nov 2013 09:19:52 +0000 Received: from [127.0.0.1] by nm34.bullet.mail.ne1.yahoo.com with NNFMP; 01 Nov 2013 09:19:31 -0000 Received: from [98.138.101.132] by nm34.bullet.mail.ne1.yahoo.com with NNFMP; 01 Nov 2013 09:16:47 -0000 Received: from [98.138.88.233] by tm20.bullet.mail.ne1.yahoo.com with NNFMP; 01 Nov 2013 09:16:47 -0000 Received: from [127.0.0.1] by omp1033.mail.ne1.yahoo.com with NNFMP; 01 Nov 2013 09:16:47 -0000 X-Yahoo-Newman-Property: ymail-4 X-Yahoo-Newman-Id: 216912.93386.bm@omp1033.mail.ne1.yahoo.com Received: (qmail 2091 invoked by uid 60001); 1 Nov 2013 09:16:47 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1383297407; bh=ElrSGo+N05yZlxD7Dv1Kvnr4pOpAmSVmGk8QQXeIeBg=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=1a7YH/TyvW2QwpNxzdJtXABZwMArq5/dkRKacLkIyqftMi4MqLyRvKT9BI8Kca9Lcdr+gT7RTB37WHN+1IaZ9tQChxyvFGbNj7ocf9wci+2DD+f7/swbf4hqITzuqJNULVRMtkZnQMnaEb5kOOeVJiLfDgWwFzi9DCT8HroYZD0= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=ayUu1PqQdjKPrj8gmP7ygqn29w49Gc9xt1V4I/vSuJBW/eugsyc35sYJVeHBP6uXAtowjJXoo54nq8xDMFzXOf8/MMk8GldrFSbTMOQKZbPlvfRE2qY7tR3iARxkblRuFGlHtDzKDHXLYWm0QvZhzmR0Q1um891eqOvbslsl4iI=; X-YMail-OSG: QyfyW68VM1mwIbkhIsrVj0C8.BdPFse5alALMXlkdS1FpOC 9zpQQ6zXb8VY1C78NPvsxoDKte1U6W61Q7k8r5ExH7BP.vNYDgvIWYommbkm Fo5TtVN4PTCAjbhIVyC_4CnVMvB8sXo412rwvb1V5dWzHjG2y6p8LjKVWfM7 i.OpA9KrZN2S2VOUhEDuYVUjAs.et69jjYyqe6HOonrRV9fxeYS583Yn0ZgL lXTsiN3SW8jRoHNCCSbTvZTrXfwbMPk6EiPw1L2KhQf6IVqBhHKwzDWUctQE tpRMxOnnAeSsdV_mAsW9o8FQCh_kmgFNQFSBpD7.VLHIDf2il3l5uKLZQ6Bw QnZ_1PzAhMf1_xwQH3YG7l0iDtSFZofev2pei5QxEzOV_d5PhTARkkSKRaz4 U5ZGNInl1Wff_XOm0uBdVkxrV4t67Vii7TLHsyL.M4H2maZZPKKkOpt_MRgZ ZeUo9JxUEsGfip80WuEq00E6NnS2XYumH4uN9KSs_ZXBKRIES8ef6FJl9DCy Q1iro3hUSp0m3naUjgkTs2f_p2w6UBBpGCBpQxyeag2_D8rOeqLS81o3kY84 G6xoWjYxR0G6cc7GyYs.qtli_yRimSz71lo0N Received: from [203.13.146.61] by web122306.mail.ne1.yahoo.com via HTTP; Fri, 01 Nov 2013 02:16:46 PDT X-Rocket-MIMEInfo: 002.001,VGhhbmtzIEFraSBmb3IgeW91ciB0aG91Z2h0cyAuLgoKWWVzLCBJIHNob3VsZCBjYWxsIHNldE5hbWVzcGFjZXMoKSAuLiBidXQgSSBuZWVkIG5hbWVzcGFjZSBNYXAgd2hpY2ggSSBjYW4gcGFzcyB0byAuLgpTbywgbXkgcXVlc3Rpb24gcmVtYWluIHNhbWUgLi4gaXMgdGhlcmUgYW55IEFQSSBvciBzZXJ2aWNlIC4uIHdoaWNoIEkgY2FuIHVzZSB0byBnZXQgTmFtZXNwYWNlIE1hcCAuLgpBbmQgSSBodiBDYW1lbCBFeGNoYW5nZSBhbmQgQ2FtZWwgRW5kcG9pbnQgb2JqZWN0IHdpdGggbWUgLi4KClBhcnNpbmcBMAEBAQE- X-Mailer: YahooMailWebService/0.8.161.596 References: <1383228175.96728.YahooMailNeo@web122305.mail.ne1.yahoo.com> Message-ID: <1383297406.1357.YahooMailNeo@web122306.mail.ne1.yahoo.com> Date: Fri, 1 Nov 2013 02:16:46 -0700 (PDT) From: Nurali Techie Reply-To: Nurali Techie Subject: Re: Namespace list - blueprint - xpath To: Aki Yoshida , "users@camel.apache.org" In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-140725594-889246250-1383297406=:1357" X-Virus-Checked: Checked by ClamAV on apache.org ---140725594-889246250-1383297406=:1357 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Thanks Aki for your thoughts ..=0A=0AYes, I should call setNamespaces() .. = but I need namespace Map which I can pass to ..=0ASo, my question remain sa= me .. is there any API or service .. which I can use to get Namespace Map .= .=0AAnd I hv Camel Exchange and Camel Endpoint object with me ..=0A=0AParsi= ng blueprint beans.xml and to extract Namespace from tag; looks= hack and dirty way ..=0AAlso, I don't know how can I get beans.xml InputSt= ream to parse for ..=A0=0A=0AI also debugged and found that .. for standard= tag having namespace xpath in beans.xml .. the blueprint container= do magic to pass all namespace while creating xpath expression object. =A0= It means; namespace list is with blueprint container .. but I don't know ho= w I can reached to there when I only have Camel Exchange and Endpoint objec= t with me.=0A=0AThanks,=0ANurali=0A=0A=0A=0AOn Thursday, October 31, 2013 9= :24 PM, Aki Yoshida wrote:=0A =0Afor the first part of = the question, maybe you forgot the set the=0Anamespace context (the prefix-= >nsuri map) in the expression?=0A=0AsetNamespaces(Map namesp= aces)=0A=0Afor the second part, you probably need to parse the file that wi= ll=0Ascan all the namespaces declared and you will see them in the=0Acorres= ponding namespace declaration handler.=0A=0A=0A2013/10/31 Nurali Techie :=0A> Hi Friends,=0A>=0A> I want to execute xpath in = my code.=A0 It means; I have xpath expression, I have exchange object with = In Message.=0A>=0A> Using 'XPathExpression' and 'XPathBuilder' classes; I s= ucceed to do so.=A0 Below is the code snippet.=0A>=0A>=A0 =A0 =A0 =A0 XPat= hExpression xpathExprObj =3D new XPathExpression("/userResponse/User/id");= =0A>=A0 =A0 =A0 =A0 xpathExprObj.setResultType(String.class);=0A>=0A>=A0 = =A0 =A0 =A0 Object result =3D xpathExprObj.evaluate(exchange, Object.class= );=0A>=0A> But, if I have xpath with namespace (i.e xpath =3D /ns0:userResp= onse/User/id).. above code throwing exception .. saying - Prefix must resol= ve to a namespace: ns0=0A>=0A> Part of Exception:=0A>=0A> org.apache.camel.= builder.xml.InvalidXPathExpression: Invalid xpath: /ns0:userResponse/User/i= d. Reason: javax.xml.xpath.XPathExpressionException=0A> at org.apache.camel= .builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:767) ~[bundlefile:2.= 11.2-sap-02]=0A> at org.apache.camel.builder.xml.XPathBuilder.evaluate(XPat= hBuilder.java:748) ~[bundlefile:2.11.2-sap-02]=0A> at org.apache.camel.buil= der.xml.XPathBuilder.evaluate(XPathBuilder.java:168) ~[bundlefile:2.11.2-sa= p-02]=0A> at *** My project code calling from here ..=0A> ..........=0A> --= -----=0A> Caused by: com.sun.org.apache.xpath.internal.domapi.XPathStyleshe= etDOM3Exception: Prefix must resolve to a namespace: ns0=0A> at com.sun.org= .apache.xpath.internal.compiler.XPathParser.errorForDOM3(XPathParser.java:6= 53) ~[na:1.6.0_33]=0A> at com.sun.org.apache.xpath.internal.compiler.Lexer.= mapNSTokens(Lexer.java:638) ~[na:1.6.0_33]=0A> at com.sun.org.apache.xpath.= internal.compiler.Lexer.tokenize(Lexer.java:265) ~[na:1.6.0_33]=0A> at com.= sun.org.apache.xpath.internal.compiler.Lexer.tokenize(Lexer.java:96) ~[na:1= .6.0_33]=0A> at com.sun.org.apache.xpath.internal.compiler.XPathParser.init= XPath(XPathParser.java:110) ~[na:1.6.0_33]=0A> at com.sun.org.apache.xpath.= internal.XPath.(XPath.java:176) ~[na:1.6.0_33]=0A> at com.sun.org.apa= che.xpath.internal.XPath.(XPath.java:264) ~[na:1.6.0_33]=0A> at com.s= un.org.apache.xpath.internal.jaxp.XPathImpl.compile(XPathImpl.java:385) ~[n= a:1.6.0_33]=0A>=0A> Upon digging; I found that .. I need to set namespaces = to XPathExpression object .. So, I need list of all namespace.=0A> I am usi= ng blueprint beans.xml .. so I need list of all namespaces defined with blu= eprint tag in beans.xml.=0A>=0A> I have camel exchange and camel endpoint o= bject with me.=0A> I want programmatic solution.=0A>=0A> Thanks,=0A> Nurali ---140725594-889246250-1383297406=:1357--