<!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=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>&nbsp;</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>&nbsp;</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">&nbsp;&nbsp;&nbsp; <FONT color=#0000ff 
size=2>when</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT 
face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
color=#0000ff size=2>$w : Worker()</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT 
face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <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">&nbsp;&nbsp;&nbsp; <FONT color=#0000ff 
size=2>then</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT 
face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <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">&nbsp;&nbsp;&nbsp; <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>&nbsp;</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>&nbsp;</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>&nbsp;</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&lt;Cheese&gt; cheeses 
=&nbsp;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>&nbsp;&nbsp;&nbsp; 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>&nbsp;</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">&nbsp;&nbsp;&nbsp; <FONT color=#0000ff 
size=2>when</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT 
face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
color=#0000ff size=2>Cheese( )</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT 
face="Courier New">&nbsp;&nbsp;&nbsp; <FONT color=#0000ff 
size=2>then</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=248215508-29012009><FONT 
face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <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">&nbsp;&nbsp;&nbsp; <FONT color=#0000ff 
size=2>end</FONT></FONT></SPAN></DIV>
<DIV><FONT color=#0000ff size=2></FONT>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  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>&nbsp;</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>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2><SPAN 
  class=968152007-29012009></SPAN></FONT>&nbsp;</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>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2><SPAN 
  class=968152007-29012009>Ankit</SPAN></FONT></DIV></BLOCKQUOTE></BODY></HTML>