<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
use SXC its a high perfromance XPath parser with JBRules integration,
no need to use eval. <br>
<a class="moz-txt-link-freetext" href="http://sxc.codehaus.org/">http://sxc.codehaus.org/</a><br>
<br>
Mark<br>
Schwenker, Stephen wrote:
<blockquote
 cite="mid:FBEF1EF7B7E5B649AB1C684991223C6E0636F035@tmg-mail2.torstar.net"
 type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta content="MSHTML 6.00.2800.1589" name="GENERATOR">
  <font color="#960000"></font>
  <div><font color="#960000"><font color="#000000" face="Arial" size="2"><span
 class="751293912-17042007">Hey all,</span></font></font></div>
  <div><font color="#960000"><font color="#000000" face="Arial" size="2"><span
 class="751293912-17042007"></span></font>&nbsp;</font></div>
  <div><font color="#960000"><font color="#000000" face="Arial" size="2"><span
 class="751293912-17042007">I'm trying to make my rule more efficient
but I'm not sure how.&nbsp; I've designed my rules based around xml
objects.&nbsp; Basically, I have these documents and XPath queries are
executed against the Object to determine if the rule should be
executed.&nbsp; The problems is, is that we have over 900 rules that need to
be executed.&nbsp; The performance isn't really that bad but I would like to
Make it even better.</span></font></font></div>
  <div><font color="#960000"><font color="#000000" face="Arial" size="2"><span
 class="751293912-17042007"></span></font>&nbsp;</font></div>
  <div><font color="#960000"><font color="#000000" face="Arial" size="2"><span
 class="751293912-17042007">To do the job,&nbsp; I have written an XmlUtils
class to execute the expression.&nbsp; The class first gets the
XPathFactory.&nbsp; Then compiles the expression and then executes the
expression.&nbsp; This happens for every expression, and will happen each
time the same expression is executed.&nbsp; I want to make the rules more
efficient by getting the XPathFactory once and&nbsp;compiling the expression
once and then execute the expression n time on the same compiled object.</span></font></font></div>
  <div><font color="#960000"><font color="#000000" face="Arial" size="2"><span
 class="751293912-17042007"></span></font>&nbsp;</font></div>
  <div><font color="#960000"><font color="#000000" face="Arial" size="2"><span
 class="751293912-17042007">I would like to know if there is a way I
can have the rule object that is generated by the package build do the
compile of the XPath Expression and then use it instead of compiling it
every time.</span></font></font></div>
  <div><font color="#960000"><font color="#000000" face="Arial" size="2"><span
 class="751293912-17042007"></span></font>&nbsp;</font></div>
  <div><font color="#960000"><font color="#000000" face="Arial" size="2"><span
 class="751293912-17042007">Here is a sample of one of my rule criteria.</span></font></font></div>
  <div><font color="#960000">&nbsp;</font></div>
  <div><font color="#960000"><font face="Arial"><font color="#000000"><font
 size="2"><span class="751293912-17042007">&nbsp;&nbsp;&nbsp; </span>asset:
AssetDocument()</font></font></font></font></div>
  <div><font color="#000000"><font size="2"><strong><font face="Arial"><span
 class="751293912-17042007">&nbsp;&nbsp;&nbsp; </span>eval</font></strong><font
 face="Arial">( XmlUtils.evaluatePathBoolean( asset,
"boolean(//ass:asset/ass:properties/ass:property[@name =
'Desk']/ass:value/text() = 'column')") )</font></font></font></div>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
  </pre>
</blockquote>
<br>
</body>
</html>