开发者

&& in XML (logical operations)

开发者 https://www.devze.com 2022-12-21 23:01 出处:网络
in an application I\'m using a config-file in which i开发者_JAVA技巧\'d like also to use \'&&\'.

in an application I'm using a config-file in which i开发者_JAVA技巧'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


<?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>


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消