-
1. Re: XPAth routing with default namespace via ESB Content-bas
marklittle Jan 14, 2008 3:22 PM (in response to tds111)Check through the forum. I'm sure this has come up before.
-
2. Re: XPAth routing with default namespace via ESB Content-bas
tobysaville Jan 15, 2008 5:04 AM (in response to tds111)i've had this issue:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=123539
there was no resolution, so i wrote my own using Jaxen. I can post the code if you want. -
3. Re: XPAth routing with default namespace via ESB Content-bas
kurtstam Jan 15, 2008 10:10 AM (in response to tds111)Hi Toby,
I think this is the same issue
http://jira.jboss.com/jira/browse/JBESB-1426
Check that and if it is then it'd be great if you can attach your code there.
Thx!
--Kurt -
4. Re: XPAth routing with default namespace via ESB Content-bas
tobysaville Jan 17, 2008 6:37 AM (in response to tds111)Hello,
i will check out that JIRA issue and post my code shortly if relevent.
in the meantime, i was wondering if it would be possible to use the local-name() function? it requires the fn: namespace to be defined in the XSL when used as a normal translation, so i dont know if it will work as part of CBR and i haven't had a chance to try it.
- toby -
5. Re: XPAth routing with default namespace via ESB Content-bas
viniciuscarvalho Jan 18, 2008 6:14 PM (in response to tds111)Hello toby. I have successfully changed the DSL Helper to support namespaces, and it was easy to do so. I've attached the code for the Namespacecontext only at the JIRA, but here's what I've done:
I've replaced the dsl file for the CBR:#JBossESB Content Based Routing using XPath DSL [when]xpathMatch "{xpath}"=msg : Message( type == MessageType.JBOSS_XML ) and eval( com.synos.csm.esb.routing.DslHelper.xmlContentMatches(msg, "{xpath}") ) [when]xpathEquals "{xpath}", "{value}"=msg : Message( type == MessageType.JBOSS_XML ) and eval( com.synos.csm.esb.routing.DslHelper.xmlContentEquals(msg, "{xpath}", "{value}") ) [when]xpathGreaterThan "{xpath}", "{value}"=msg : Message( type == MessageType.JBOSS_XML ) and eval( com.synos.csm.esb.routing.DslHelper.xmlContentGreaterThan(msg, "{xpath}", "{value}") ) [when]xpathLessThan "{xpath}", "{value}"=msg : Message( type == MessageType.JBOSS_XML ) and eval( com.synos.csm.esb.routing.DslHelper.xmlContentLessThan(msg, "{xpath}", "{value}") ) [then]Log : "{message}"=System.out.println("{message}"); [then]Destination : "{message}"=destinations.add("{message}");
Then, for each method on it, I've just modified the xpath related block:CustomNamespaceContext cn = new CustomNamespaceContext(); cn.addNamespace("acme","http://www.acme.com.br/schemas"); XPath xpath = xpf.newXPath(); xpath.setNamespaceContext(cn);
And that was it :)
My suggestion was to have an way to access the configTree so one could set the namespaces on the config element of the CBR :)
Hope it helps
Regards -
6. Re: XPAth routing with default namespace via ESB Content-bas
tobysaville Jan 23, 2008 5:22 AM (in response to tds111)Hi viniciuscarvalho,
thats a good solution, thanks for the idea! can you add a link to your jira issue too?
- toby