Duplicate some parts of XML without rewriting them

无人久伴 提交于 2019-12-01 22:54:15
imhotap

You can use SGML/XML"entities" for that, which can contain replacement text or markup for reuse at multiple places:

<!DOCTYPE arguments [
  <!ENTITY user-and-password
   '<argument name="user" type="text"/>
    <argument name="password" type="password"/>'>
]>
<arguments>
  <argument name="create">
    &user-and-password;
  </argument>
  <argument name="update">
    &user-and-password;
  </argument>
</arguments>

Note that you have to adapt the DOCTYPE: it must match the document element of your XML.

See also XML configuration inheritance, avoid duplications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!