有一个类似的宏定义
<macrodef name = "printSomething">
<attribute name = "attribute1" />
<element name = "args" optional="true"/>
<sequential>
<echo message = "attr is: @{attribute1} and the arguments are:"><args/></echo>
</sequential>
</macrodef>
这将像下面的示例一样调用
<printSomething attribute1="thisIsAttribute">
<args>
<arg value="element1"/>
<arg value="element2"/>
</args>
</printSomething>
如何打印元素 element1 和 element2 如下所示?
attr is: thisIsAttribute and the arguments are: element1 element2
这种方法对我没有帮助。我不想将 xml 的内容保存到属性中并打印该属性。