Bob,
Instead of copying the XML document data into facts, you should definstance
the XML DOM nodes and have your rules pattern match directly on the
node/element/attributes, etc.
The jess (and java) syntax gets a little ugly when working directly with XML
DOM but it is workable. A better approach would be to use JDOM which cuts
down on the node/element/attribute traversals quite a bit...
However, if you don't want to change your current setup, you can simply
assert the XML DOM (or JDOM) nodes as an additional slot in the
facts/instances you are already creating. This slot would presumably be an
external address:
new Value(xmlNode, RU.EXTERNAL_ADDRESS);
and then you can access and manipulate the xml node just like any other java
object in jess:
(defrule augment-empty-accounts
(account (id ?id) (balance ?balance&:(< ?balance 0)) (xml-node ?node))
=>
;; manipulate ?node using jess code (e.g. add attribute nodes, etc.)
)
Good luck!
alan
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Bob Stewart
Sent: Tuesday, September 18, 2001 6:48 AM
To: [EMAIL PROTECTED]
Subject: JESS: jess/java question
Hi,
I am integrating jess into my EJB code. I am
trying to create an XML document enhancement
service. What I am doing is taking in the
XML document as a byte array, turning them into
jess facts, and running the rules against those
facts. Based on the defined rules, I will want
to change fields(change priority, add a comment)
to the XML document.
So far, I am reading in the XML document, and
the rules are firing okay. I am just not sure
how I can update the XML document. Is there a way
for me to in a jess function(deffunction) pass
something back into my calling java program? Once
I get a rule to fire, I need to be able to get the
information to change the XML back to my java code.
Or somehow be able to change the XML. I am
open to any ideas.
Thanks,
Bob Stewart
__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify
[EMAIL PROTECTED]
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------