【发布时间】:2018-05-04 20:41:25
【问题描述】:
我有一个包含重复部分的 XML 文件,例如:
<argument name="create">
<argument name="user" type="text"></argument>
<argument name="password" type="password"></argument>
(and so on)
</argument>
<argument name="update">
<argument name="user" type="text"></argument>
<argument name="password" type="password"></argument>
(and so on)
</argument>
我希望在 create 和 update 之间声明一次,然后在 create 和 update 之间添加一个单行。这样可以节省很多行数。
有什么方法可以在 XML 中做到这一点?
【问题讨论】:
-
如果您知道如何使用 XSLT,那可能就是您的答案。但是,XSLT 不适合胆小的人。
-
我认为您需要使用循环。也许这可以帮助:stackoverflow.com/questions/3462418/…
标签: xml code-duplication