[rules-users] Question about in XML: literal-restriction on "null" value

Wolfgang Laun wolfgang.laun at gmail.com
Fri Feb 25 02:10:18 EST 2011


Superficially, his is a bug in XmlDumper, but it cuts a little deeper -
first look I don't see that the internal representation of String values
such as "null" or "true" or "false" is possible for literal constraints.
(I'll open a JIRA forthwith.)

You have these two options as a workaround:

(1) Create a
   global String strnull
and initialize it with the String "null"
   ksession.setGlobal( "strnull", "null" );

(2) Use
   keyValue== ("null")
which Xml-dumps into a different (correct) representation.

-W


On 25 February 2011 02:32, Christina Lau <lau.christina at hit.com.hk> wrote:

>
> Dear all,
>
> My system is transforming internal data structure to drools rule language
> XML file. For particular evaluation on a string field, how can I do so
> happen the evaluating value is one of the keywords?
>
> For example,
>
> I need to check if
>        keyValue=="null"
>
> In rule language in XML, through the XmlDumper,
>        <field-constraint field-name="keyValue">
>                    <literal-restriction evaluator="==" value="null" />
>
> However, this is the same for evaluation of
>        keyValue==null  //check if keyValue is null or not
>
>
> Would someone know how to tell the engine the different scenario in rule
> language XML file,
>    evaluate on the content, and
>    nullable of the field?
>
> Thanks a lot for your help
>
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/Question-about-in-XML-literal-restriction-on-null-value-tp2572293p2572293.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110225/95146174/attachment.html 


More information about the rules-users mailing list