[rules-users] how to use xml file instead of java object ?

Jaroslaw Kijanowski kijanowski at gmail.com
Thu Aug 20 11:11:06 EDT 2009


Hi,
  have a look at the dsl:

http://anonsvn.jboss.org/repos/labs/labs/jbossesb/tags/JBESB_4_6/product/services/jbrules/src/main/resources/XPathLanguage.dsl

This rule expects an object of type org.jboss.soa.esb.message.Message 
which contains the XML in its body.

Also note that a lot of stuff is going on behind the scenes:
http://anonsvn.jboss.org/repos/labs/labs/jbossesb/tags/JBESB_4_6/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/DslHelper.java

Drools Pipeline might be helpful in inserting XML data into sessions.
https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-expert/html_single/index.html#d0e1992

Cheers,
  Jarek

tv.raghavan wrote:
> I remember seeing a sample in jboss-esb sample where they were able to use
> xpath to query a xml file
> 
> [sample extract]
> package com.jboss.soa.esb.routing.cbr
> 
> #list any import classes here.
> import org.jboss.soa.esb.message.Message;
> import org.jboss.soa.esb.message.format.MessageType;
> 
> expander XPathLanguage.dsl
> 
> #declare any global variables here
> global java.util.List destinations;
> 
> rule "Blue Routing Rule using XPATH"	
> 	when
> 		xpathEquals "/Order/@statusCode", "0"
> 	then 
> 	    Log : "Blue Team";
> 		Destination : "blue";		
> end
> 
> Is it possible to use this approach to use a xml as input to drool vs java
> object ?
> 
> Thanks,
> -Raghav



More information about the rules-users mailing list