<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
checkout the unit test test, hopefully that should help:<br>
<a class="moz-txt-link-freetext" href="http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-pipeline/drools-transformer-smooks/src/test/java/org/drools/runtime/pipeline/impl/SmookStatefulSessionTest.java">http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-pipeline/drools-transformer-smooks/src/test/java/org/drools/runtime/pipeline/impl/SmookStatefulSessionTest.java</a><br>
<br>
Mark<br>
Dave Macpherson wrote:
<blockquote cite="mid:000f01c99b6e$ebe23c70$c3a6b550$@com" type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta name="Generator" content="Microsoft Word 12 (filtered medium)">
  <title>Smooks and Drools Pipeline</title>
  <style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
 /* List Definitions */
 @list l0
        {mso-list-id:2117098274;
        mso-list-template-ids:-1000724504;}
@list l0:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:36.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Symbol;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
-->
  </style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
  <div class="Section1">
  <p><span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">Hey
guys
(Drools newbie here)</span> <o:p></o:p></p>
  <p><span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">I'm
*attempting* to use the Drools/Smooks pipeline functionality to insert
facts
into my knowledgebase and I'm having a little trouble figuring out
exactly how
to do this. I've read the API docs for the 5.0.0.M5 and looked at the
test
cases but I guess I'm still not quite getting it, so I'm hoping someone
here
can point me in the right direction.</span><o:p></o:p></p>
  <p><span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">I've
got an
XML file defined basically like this:</span> <o:p></o:p></p>
  <p><span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">&lt;submission&gt;</span>
  <br>
  <span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;
&lt;facility&gt;</span> <br>
  <span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;faccode&gt;xxx&lt;/faccode&gt;</span> <br>
  <span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;
&lt;/facility&gt;</span> <br>
  <span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;
&lt;lineitem&gt;</span> <br>
  <span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;acctcode&gt;xxxx&lt;/acctcode&gt;</span> <br>
  <span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;amount&gt;999&lt;/amount&gt;</span> <br>
  <span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;
&lt;lineitem&gt;</span> <br>
  <span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;
&lt;lineitem&gt;</span> <br>
  <span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;acctcode&gt;xxxx&lt;/acctcode&gt;</span> <br>
  <span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;amount&gt;999&lt;/amount&gt;</span> <br>
  <span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;
&lt;lineitem&gt;</span> <br>
  <span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">&lt;submission&gt;</span>
  <o:p></o:p></p>
  <p><span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">Within
the
XML file, there is 1 and only 1 "facility" node and multiple
"lineitem" nodes. I'd like to use the DroolsSmooks pipleline
functionality to use Smooks to insert 1 "facility" fact and multiple
"lineitem" facts into my knowledgbase.</span><o:p></o:p></p>
  <p><span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">The
code
I've written to do this is similar to the following (taken from sample
test
code I've seen in the Drools source):</span><o:p></o:p></p>
  <p style="margin-left: 36pt;"><span
 style="font-size: 10pt; font-family: &quot;Courier New&quot;;">StatefulKnowledgeSession
ksession = kbase.newStatefulKnowledgeSession();</span> <br>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">Action
executeResultHandler = PipelineFactory.newExecuteResultHandler();</span>
  <br>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">KnowledgeRuntimeCommand
insertStage = PipelineFactory.newStatefulKnowledgeSessionInsert();</span>
  <br>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">insertStage.setReceiver(executeResultHandler);</span>
  <br>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">Smooks
smooks = new
Smooks("smooks-config.xml");</span> <br>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">Transformer
transformer = PipelineFactory.newSmooksFromSourceTransformer(smooks,
"root");</span> <br>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">transformer.setReceiver(insertStage);</span>
  <br>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">Pipeline
pipeline =
PipelineFactory.newStatefulKnowledgeSessionPipeline(ksession);</span> <br>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">pipeline.setReceiver(transformer);</span>
  <br>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">ResultHandlerImpl
resultHandler = new ResultHandlerImpl();</span> <br>
  <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">pipeline.insert(ResourceFactory.newClassPathResource("submission.xml"),
resultHandler );</span> <o:p></o:p></p>
  <p><span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">While
stepping through the above code, the last line returns an NPE. I've
tried
playing with the "Transformer transformer - PipeLineFactory&#8230;" line,
substituting "root" for something else and it goes into an infinite
loop. What is the purpose of the "root" value being set in this line?</span><o:p></o:p></p>
  <p><span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">Can
anyone
tell me if I'm even on the right track here, or am I misunderstanding
what the
Smooks data loader can do for me?</span><o:p></o:p></p>
  <p><span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">Regards,
  <o:p></o:p></span></p>
  <p><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, 125);">Dave<o:p></o:p></span></p>
  </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>