问题描述:

I have an XML file that contains URLs.

I want to add cases because I need a different URL each time.

I know I can do this in Java, but I'd prefer not to change my Java code for now.

网友答案:

XML files contain data, not logic. So they can't hold conditions.

网友答案:

You may use XSLT but I guess you'll have to change code to handle it! XML is a data container, how to use and "see" (XPath for example) that data is managed by its consumer (to minimize changes you may simply expose the query in the XML file).

网友答案:

The nature of XML is that it stores data only. There should be nothing except data itself, so, you should make the conditional in your code.

网友答案:

It's fine to put conditions in your XML. For example, I have documents like this:

<p if="EU-user">VAT is not payable if you are registered for VAT in an EU country other than the UK</p> 

Putting conditions like that in your data makes excellent sense. But it only makes sense if the recipient is capable of interpreting them.

网友答案:

Take a look at PMML (Predictive Modeling Markup Language)

相关阅读:
Top