Link to home
Start Free TrialLog in
Avatar of BrianMc1958
BrianMc1958

asked on

NEWBIE: How to store boolean logic in XML?

Dear Experts,

I have a dumb question.  Assume I want to store three test questions, in which BOTH of the first two are true, OR the third is true.  For instance, "If ((Birdie is blue) AND (Duckie is yellow)) OR (Bear is purple)..."

(I said this was a dumb question...)  

One way I can think of storing this would be to literally include something like parentheses and logical operators, like this:

<PAREN>
  <PAREN>
    <TEST>Birdie is blue</TEST>
    <OPERATOR>AND</OPERATOR>
    <TEST>Duckie is yellow</TEST>
  </PAREN>
</PAREN>
<OPERATOR>OR</OPERATOR>
<TEST>Bear is purple</TEST>

But there must be a better way, right?  The PARENs, in particular, seem very klutzy.  Is there a way to get their functionality directly from XML?

Thanks!
BrianMc1958
ASKER CERTIFIED SOLUTION
Avatar of McExp
McExp
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial