2 Replies Latest reply on Feb 16, 2014 4:49 AM by igarashitm

    Is it possible to use namespace prefixes in XML DSL of a route definition

    essey

      I have following JAVA DSL

      Namespaces ns = new Namespaces("foo", "http://schemas.example.com/foo");
      
      public void configure() throws Exception {
              from("switchyard://Service1")
              .choice()
                  .when()
                     .xpath("count(/foo:Message/foo:Process)>0", ns)
                     .setHeader("header1", simple("bar"))
                     .setHeader("header1").xpath("/foo:Message/foo:Process/foo:Id", Integer.class, ns)
              .to("switchyard://Service2");
      }
      

       

      Is it possible to do same using XML DSL?

      I tried to add xmlns:foo="http://schemas.example.com/foo" to my route definition like following, but it didn't work. Also tried to add it to the toplevel element in switchyard.xml

       

      <route id="myroute" xmlns="http://camel.apache.org/schema/spring" xmlns:foo="http://schemas.example.com/foo">
          <from uri="switchyard://Service1"/>
          <choice>
              <when>
                  <xpath>count(/foo:Message/foo:Process)>0</xpath>
                  <setHeader headerName="header1"><simple>bar</simple></setHeader>
                  <setHeader headerName="header2">
                      <xpath resultType="java.lang.Integer">/foo:Message/foo:Process/foo:Id</xpath>
                  </setHeader>
              </when>
          </choice>
          <to uri="switchyard://Service2"/>
      </route>
      

       

      Or is it currently not supported?

       

      Thanks

      Peter