Hello Andreas, I understand that, but what if the message has no-prefix namespace something like:
<Message xmlns="http://www.company.com/test"/> .... ... </Message> This what I have most of the messages that I am processing with Synapse, have not prefix name space or default namespace declaration. Which is the problem I am facing. Thanks & Regards, Abid -----Original Message----- From: Andreas Veithen [mailto:[email protected]] Sent: Friday, October 08, 2010 10:07 AM To: [email protected] Subject: Re: If the message has name space setting the switch mediator does not work? Try with something like this: <switch source="//p:Message/p:header/p:msgType" xmlns:p="http://www.company.com/test"> Note that XPath expressions in Synapse configuration files are supposed to work the same way as XPath expressions in XSLT, so if you have a colleague who is familiar with XSLT, he may help you to figure out the details. Andreas On Fri, Oct 8, 2010 at 17:46, Abid Khan-EXT <[email protected]> wrote: > I am not sure what is the difference in both ways here is how I am creating > the switch: > > <switch source="//Message/header/msgType"> > <case regex="RequesResponse"> > <validate> > <schema key="Message01"/> > <on-fail> > <sequence key="ValidationFaultSequence" /> > </on-fail> > </validate> > </case> > <case regex="Publish"> > <validate> > <schema key=" Message02"/> > <on-fail> > <sequence key="ValidationFaultSequence" /> > </on-fail> > </validate>^M > </case> > </switch> > > This exact switch works if the name space of the document is removed, and > does not work otherwise. > > Please advise. > > Thanks & Regards, > Abid > > -----Original Message----- > From: Supun Kamburugamuva [mailto:[email protected]] > Sent: Thursday, October 07, 2010 8:29 PM > To: [email protected] > Subject: Re: If the message has name space setting the switch mediator does > not work? > > I believe you are using XPath to get a value of a element. You can write a > Xpath in such a way that it works both with namespace qualified elements as > well as normal elements. > > Thanks, > Supun.. > > On Tue, Sep 28, 2010 at 9:12 PM, Abid Khan-EXT <[email protected]>wrote: > >> Hello all, >> >> I am receiving a message and the switch works if I take the namespace >> string out of the message, but I cannot tell the sender to remove it. Is >> there anything I can do that synapse can handle the name space. >> >> Message that starts with something like this is not handled properly, by >> "switch" mediator. >> >> <Request xmlns="http://www.company.com/test" xmlns:xsi=" >> http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" >> http://www.company.com/test ../test/Request.xsd"> >> >> >> Thanks & Regards, >> >> Abid Khan >> Java Consultant >> >> >> > > > -- > Tech Lead, WSO2 Inc > http://wso2.org > supunk.blogspot.com >
