Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

NEWBIE: How to store boolean logic in XML?

Posted on 2007-11-21
1
Medium Priority
?
1,282 Views
Last Modified: 2008-02-01
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
0
Comment
Question by:BrianMc1958
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 16

Accepted Solution

by:
McExp earned 2000 total points
ID: 20329961
I would structure the XML as follows:-
<TEST Op="OR">
  <OPERAND1>
    <TEST Op="AND">
      <OPERAND1>Birdie is blue</OPERAND1>
      <OPERAND2>Duckie is yellow</OPERAND2>
    </TEST>
  </OPERAND1>
  <OPERAND2>Bear is purple</OPERAND2>
</TEST>

Open in new window

0

Featured Post

Major Serverless Shift

Comparison of major players like AWS, Microsoft Azure, IBM Bluemix, and Google Cloud Platform

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question