如何在XML中使用属性值中的常量或变量 [英] How to use constant or variable in attribute value in XML
问题描述
我内部有一个XML命令,我想为属性使用常量值或变量。请参阅以下命令。
< Test spec =generatedSpec.xmlname =Check Load Firmware Data CommandreuseLoadedDomain =true>
现在在这个文件中我想声明一个常量,并希望将此常量用作测试命令的spec属性的值。
Hi,
I have a XML command inside that i want to use constant value or variable for a attribute. See the below command.
<Test spec="generatedSpec.xml" name="Check Load Firmware Data Command" reuseLoadedDomain="true">
Now in this file i want to declare a constant and want to use this constant as a value for "spec" attribute of test command.
推荐答案
根据您的需要,您可能会发现DTD实体很有用:
Depending on what you need, you may find DTD entities useful:
<!ENTITY spec "generatedSpec.xml">
<test spec="&spec;" name="Check Load Firmware Data Command" reuseloadeddomain="true">
</test>
您可以在文档元素之前声明实体。
您还可以使用实体从外部包含一段XML将文件存入您的XML。
查看更多信息此处 [ ^ ]
You can declare entities before your document element.
You can also use entities to include a piece of XML from an external file into your XML.
See more info here[^]
这篇关于如何在XML中使用属性值中的常量或变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!