Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

&& in XML (logical operations)

Tags:

xml

in an application I'm using a config-file in which i'd like also to use '&&'.

<?xml version="1.0" encoding="ISO-8859-1" ?>
<use-case id="customer">
    <precondition evaluate="!empty customer && !empty product" />
    <menu-item id="customer" label="Kunde" />
</use-case>

With this code I'm getting an validation error owing to the '&&' ...

Is there any solution to express this?

THX

like image 283
ich-bin-drin Avatar asked Mar 03 '10 08:03

ich-bin-drin


2 Answers

<?xml version="1.0" encoding="ISO-8859-1" ?>
<use-case id="customer">
    <precondition evaluate="!empty customer &amp;&amp; !empty product" />
    <menu-item id="customer" label="Kunde" />
</use-case>
like image 166
whiskeysierra Avatar answered Nov 11 '22 18:11

whiskeysierra


Being able to shove almost any old rubbish into an XML file is a job for CDATA, something like:

<precondition name="evaluate">
    <![CDATA[!empty customer && !empty product]]>
</precondition>

Then you don't have to worry about anything other than the ]] possibility.

like image 22
paxdiablo Avatar answered Nov 11 '22 17:11

paxdiablo