6 Replies Latest reply on Mar 9, 2009 6:44 AM by kconner

    Enhancement to XPathLanguage.dsl

    kurtstam

      I noticed the new DslHelper, very nice Daniel. This inspired me to propose the following addition to the XPathLanguage.dsl

      Add:

      [then]SetAsString : "{key}", "{xpath}"=msg.getBody().add("{key}",org.jboss.internal.soa.esb.services.routing.cbr.DslHelper.selectAsString(msg, "{xpath}") );

      This will allow the user to write rules that can extract some fields from the XML and set them as named parameters on the Message.Body.

      For example the rule:

      when
       xpathGreaterThan "/price", "1.00"
       then
       Log : "XPath Greater Then";
       Destination : "XML_XPath_GreaterThan_Destination";
       SetAsString : "priceInDollars", "/price";
      


      would add the named parameter "priceInDollars" to the ESBMessage with a value of "1.00"

      I guess you can also consider adding SetAsNumber etc.

      Cheers,

      --Kurt