<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3314" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=954132910-29012009><FONT face=Arial
color=#0000ff size=2>Received from Anit, which might help others
comment....</FONT></SPAN></DIV><BR>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Gupta, Ankit (Ankit)
[mailto:gupta11@avaya.com] <BR><B>Sent:</B> 29 January 2009
10:04<BR><B>To:</B> Anstis, Michael (M.)<BR><B>Subject:</B> RE: [rules-users]
Parsing XML using Drools<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=515315309-29012009>Hi Mike,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=515315309-29012009>
Thanks for prompt reply ,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff><SPAN
class=515315309-29012009><FONT face=Arial size=2>Actually right now I am
streaming the xml </FONT>
<P align=left><FONT face=Arial><FONT size=2><FONT color=#008080><FONT
color=#008080><</FONT></FONT><FONT color=#3f7f7f><FONT
color=#3f7f7f>BenchmarkResultsFor</FONT></FONT><FONT color=#008080><FONT
color=#008080>></P></FONT></FONT></FONT></FONT>
<P align=left><FONT face=Arial size=2></FONT></P>
<P align=left><FONT face=Arial><FONT size=2><FONT color=#008080><SPAN
class=515315309-29012009> </SPAN><</FONT><FONT
color=#3f7f7f><FONT color=#3f7f7f>Benchmark</FONT></FONT><FONT
color=#008080><FONT color=#008080>></FONT></FONT>DataProcessing<FONT
color=#008080><FONT color=#008080></</FONT></FONT><FONT color=#3f7f7f><FONT
color=#3f7f7f>Benchmark</FONT></FONT><FONT color=#008080><FONT
color=#008080>></P></FONT></FONT></FONT></FONT>
<P align=left><FONT face=Arial size=2></FONT></P>
<P align=left><FONT face=Arial><FONT size=2><FONT color=#008080><SPAN
class=515315309-29012009> </SPAN><</FONT><FONT
color=#3f7f7f><FONT color=#3f7f7f>Workload</FONT></FONT><FONT
color=#008080><FONT color=#008080>></FONT></FONT>1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16<FONT color=#008080><FONT
color=#008080></</FONT></FONT><FONT color=#3f7f7f><FONT
color=#3f7f7f>Workload</FONT></FONT><FONT color=#008080><FONT
color=#008080>></P></FONT></FONT></FONT></FONT>
<P align=left><FONT face=Arial size=2></FONT></P>
<P align=left><FONT face=Arial><FONT size=2><FONT color=#008080><SPAN
class=515315309-29012009> </SPAN><</FONT><FONT
color=#3f7f7f><FONT color=#3f7f7f>Memory</FONT></FONT><FONT
color=#008080><FONT color=#008080>></FONT></FONT>4, 4, 4, 8, 8, 12, 12, 16,
24, 24, 24, 24, 24, 24, 24, 24<FONT color=#008080><FONT
color=#008080></</FONT></FONT><FONT color=#3f7f7f><FONT
color=#3f7f7f>Memory</FONT></FONT><FONT color=#008080><FONT
color=#008080>></P></FONT></FONT></FONT></FONT>
<P align=left><FONT face=Arial size=2></FONT></P>
<P><FONT face=Arial><FONT size=2><FONT color=#008080><FONT
color=#008080></</FONT></FONT><FONT color=#3f7f7f><FONT
color=#3f7f7f>BenchmarkResultsFor</FONT></FONT><FONT color=#008080><FONT
color=#008080>></FONT></FONT></FONT></FONT></P>
<P><FONT face=Arial><FONT size=2><FONT color=#008080><FONT
color=#008080></FONT></FONT></FONT></FONT> </P>
<P><FONT size=+0><FONT size=+0><FONT size=+0><FONT face=Arial size=2><SPAN
class=515315309-29012009>here we are using apache math api for interpolation
</SPAN></FONT></FONT></FONT></FONT></P>
<P><FONT size=+0><FONT size=+0><FONT size=+0><FONT face=Arial size=2><SPAN
class=515315309-29012009></SPAN></FONT></FONT></FONT></FONT> </P><FONT
size=+0><FONT size=+0><FONT size=+0><FONT size=+0><SPAN
class=515315309-29012009><B><FONT color=#7f0055><FONT color=#7f0055>
<P align=left><FONT face=Arial size=2>public</FONT></B></FONT></FONT><FONT
face=Arial><FONT size=2><FONT color=#000000> MemoryBenchmarkResult(String
name, </FONT><B><FONT color=#7f0055><FONT
color=#7f0055>double</B></FONT></FONT></FONT></FONT><FONT face=Arial><FONT
size=2><FONT color=#000000>[] x, </FONT><B><FONT color=#7f0055><FONT
color=#7f0055>double</B></FONT></FONT></FONT></FONT><FONT face=Arial
color=#000000 size=2>[] y) {</FONT></P>
<P align=left><B><FONT color=#7f0055><FONT color=#7f0055><FONT face=Arial
size=2>this</FONT></B></FONT></FONT><FONT size=2><FONT face=Arial>.<FONT
color=#0000c0><FONT color=#0000c0>hostFunction</FONT></FONT></FONT><FONT
face=Arial> = name;</FONT></FONT></P>
<P align=left><FONT face=Arial size=2></FONT></P>
<P align=left><FONT color=#3f7f5f><FONT color=#3f7f5f><FONT face=Arial
size=2>// Create the interpolation function</FONT></P></FONT></FONT>
<P align=left><FONT size=2><FONT face=Arial>SplineInterpolator i1 =
</FONT><B><FONT color=#7f0055><FONT color=#7f0055><FONT
face=Arial>new</FONT></B></FONT></FONT></FONT><FONT face=Arial size=2>
SplineInterpolator();</FONT></P>
<P align=left><B><FONT color=#7f0055><FONT color=#7f0055><FONT face=Arial
size=2>this</FONT></B></FONT></FONT><FONT size=2><FONT face=Arial>.<FONT
color=#0000c0><FONT color=#0000c0>workload</FONT></FONT></FONT><FONT
face=Arial> = x;</FONT></FONT></P>
<P align=left><B><FONT color=#7f0055><FONT color=#7f0055><FONT face=Arial
size=2>this</FONT></B></FONT></FONT><FONT face=Arial><FONT size=2>.<FONT
color=#0000c0><FONT color=#0000c0>memory</FONT></FONT> = y;</FONT></P></FONT>
<P align=left><B><FONT color=#7f0055><FONT color=#7f0055><FONT face=Arial
size=2>this</FONT></B></FONT></FONT><FONT face=Arial><FONT size=2>.<FONT
color=#0000c0><FONT color=#0000c0>interpolator</FONT></FONT> =
i1.interpolate(<B><FONT color=#7f0055><FONT
color=#7f0055>this</B></FONT></FONT></FONT></FONT><FONT face=Arial><FONT
size=2>.<FONT color=#0000c0><FONT color=#0000c0>workload</FONT></FONT>,
<B><FONT color=#7f0055><FONT
color=#7f0055>this</B></FONT></FONT></FONT></FONT><FONT size=2><FONT
face=Arial>.<FONT color=#0000c0><FONT
color=#0000c0>memory</FONT></FONT></FONT><FONT face=Arial>);</FONT></FONT></P>
<P><FONT face=Arial size=2>}</FONT></P>
<P><FONT face=Arial size=2></FONT> </P>
<P><SPAN class=515315309-29012009><FONT face=Arial size=2>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 .</FONT></SPAN></P>
<P><SPAN class=515315309-29012009><FONT face=Arial size=2>This thing I want to
do with Drools ...... as I know XML Streaming is possible in Drools
.</FONT></SPAN></P>
<P><SPAN class=515315309-29012009><FONT face=Arial
size=2></FONT></SPAN> </P>
<P><SPAN class=515315309-29012009><FONT face=Arial
size=2></FONT></SPAN> </P>
<P><SPAN class=515315309-29012009><FONT face=Arial
size=2>Regards</FONT></SPAN></P>
<P><SPAN class=515315309-29012009><FONT face=Arial
size=2>Ankit</FONT></SPAN></P>
<P><SPAN class=515315309-29012009><FONT face=Arial
size=2></FONT></SPAN> </P>
<P><SPAN class=515315309-29012009><FONT face=Arial
size=2></FONT></SPAN> </P></SPAN></FONT></FONT></FONT></FONT>
<P><FONT face=Arial><FONT size=2><FONT color=#008080><FONT color=#008080><FONT
color=#0000ff></FONT> </P></FONT></FONT></FONT></FONT></SPAN></FONT></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>Anstis,
Michael (M.)<BR><B>Sent:</B> Thursday, January 29, 2009 2:48 PM<BR><B>To:</B>
Rules Users List<BR><B>Subject:</B> RE: [rules-users] Parsing XML using
Drools<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT face=Arial
color=#0000ff size=2>It is not clear how you want to use the
XML?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT face=Arial
color=#0000ff size=2>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:-</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT
face="Courier New" color=#0000ff size=2>rule "get some XML
facts"</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT
face="Courier New"> <FONT color=#0000ff
size=2>when</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT
face="Courier New"> <FONT
color=#0000ff size=2>$w : Worker()</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT
face="Courier New"> <FONT
color=#0000ff size=2>Cheese( ) from
$w.getCheesesFromXML();</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT
face="Courier New"> <FONT color=#0000ff
size=2>then</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT
face="Courier New"> <FONT
color=#0000ff size=2>//Do something with cheese</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT
face="Courier New"> <FONT color=#0000ff
size=2>end</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT face=Arial
color=#0000ff size=2>Obviously the XML need not be true serialised objects (in
a JAXB sense) but simply the properties that "getCheeseFromXML"
rehydrates.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT face=Arial
color=#0000ff size=2>Drools is not exposing any of the XML libraries; they are
merely used by your code. The above would be (partially) equivalent
to:-</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT
face="Courier New" color=#0000ff size=2>Worker w = new
Worker();</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT
face="Courier New" color=#0000ff size=2>List<Cheese> cheeses
= w.getCheesesFromXML();</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT
face="Courier New" color=#0000ff size=2>for(Cheese c : cheeses)
{</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT
face="Courier New" color=#0000ff size=2>
wm.insert(c);</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT
face="Courier New" color=#0000ff size=2>}</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT
face="Courier New" color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT
face="Courier New" color=#0000ff size=2>rule "Cheese
pre-loaded"</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT
face="Courier New"> <FONT color=#0000ff
size=2>when</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT
face="Courier New"> <FONT
color=#0000ff size=2>Cheese( )</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT
face="Courier New"> <FONT color=#0000ff
size=2>then</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT
face="Courier New"> <FONT
color=#0000ff size=2>//Do something with cheese</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT
face="Courier New"> <FONT color=#0000ff
size=2>end</FONT></FONT></SPAN></DIV>
<DIV><FONT color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=248215508-29012009><FONT face=Arial color=#0000ff
size=2>Partially equivalent as you could retract Cheese( ) in the second way
which would affect truth maintenance whereas the first way would (I believe)
not.</FONT></SPAN></DIV>
<DIV><SPAN class=248215508-29012009><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=248215508-29012009><FONT face=Arial color=#0000ff size=2>With
kind regards,</FONT></SPAN></DIV>
<DIV><SPAN class=248215508-29012009><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=248215508-29012009><FONT face=Arial color=#0000ff
size=2>Mike</FONT></SPAN></DIV>
<DIV><BR></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>Gupta,
Ankit (Ankit)<BR><B>Sent:</B> 29 January 2009 07:22<BR><B>To:</B>
rules-users@lists.jboss.org<BR><B>Subject:</B> [rules-users] Parsing XML
using Drools<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=2><SPAN class=968152007-29012009>Hi
All,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=968152007-29012009>
How can we read and parse a XML file using drools ?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=968152007-29012009></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=968152007-29012009>Does Drools
support the SAX or DOM parsing .</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=968152007-29012009></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=968152007-29012009></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=968152007-29012009>Regards</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=968152007-29012009></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=968152007-29012009>Ankit</SPAN></FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>