I am not sure on what you are trying to achieve. Drools is a Rule Engine and not a XML parser; the nearest I could find to what you are reporting ("I know XML Streaming is possible in Drools") is the following. http://netzooid.com/blog/2007/03/16/sxc-simple-xml-compiler-jaxb-runtime -streaming-xpath-implementation-and-more/ Can you enlighten me with your knowledge of XML Streaming in Drools?
________________________________ From: Gupta, Ankit (Ankit) [mailto:gupt...@avaya.com] Sent: 29 January 2009 10:04 To: Anstis, Michael (M.) Subject: RE: [rules-users] Parsing XML using Drools Hi Mike, Thanks for prompt reply , Actually right now I am streaming the xml <BenchmarkResultsFor> <Benchmark>DataProcessing</Benchmark> <Workload>1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16</Workload> <Memory>4, 4, 4, 8, 8, 12, 12, 16, 24, 24, 24, 24, 24, 24, 24, 24</Memory> </BenchmarkResultsFor> here we are using apache math api for interpolation public MemoryBenchmarkResult(String name, double[] x, double[] y) { this.hostFunction = name; // Create the interpolation function SplineInterpolator i1 = new SplineInterpolator(); this.workload = x; this.memory = y; this.interpolator = i1.interpolate(this.workload, this.memory); } here we are passing the values of X Axis (Workload) and we get the values of Y Axis (Memory ). Reading or Streaming of this XML are doing using SAX . This thing I want to do with Drools ...... as I know XML Streaming is possible in Drools . Regards Ankit ________________________________ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Anstis, Michael (M.) Sent: Thursday, January 29, 2009 2:48 PM To: Rules Users List Subject: RE: [rules-users] Parsing XML using Drools It is not clear how you want to use the XML? If the XML represents Facts then you could use a worker Fact and "FROM" to deserialise them and make them available to WM. For example:- rule "get some XML facts" when $w : Worker() Cheese( ) from $w.getCheesesFromXML(); then //Do something with cheese end Obviously the XML need not be true serialised objects (in a JAXB sense) but simply the properties that "getCheeseFromXML" rehydrates. Drools is not exposing any of the XML libraries; they are merely used by your code. The above would be (partially) equivalent to:- Worker w = new Worker(); List<Cheese> cheeses = w.getCheesesFromXML(); for(Cheese c : cheeses) { wm.insert(c); } rule "Cheese pre-loaded" when Cheese( ) then //Do something with cheese end Partially equivalent as you could retract Cheese( ) in the second way which would affect truth maintenance whereas the first way would (I believe) not. With kind regards, Mike ________________________________ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Gupta, Ankit (Ankit) Sent: 29 January 2009 07:22 To: rules-users@lists.jboss.org Subject: [rules-users] Parsing XML using Drools Hi All, How can we read and parse a XML file using drools ? Does Drools support the SAX or DOM parsing . Regards Ankit
_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users