我有这个
<Connector protocol="HTTP/1.1" redirectPort="8443"/>
如何使用xmltask添加此属性?
<Connector protocol="HTTP/1.1" redirectPort="8443" newAttribute="VALUE"/>
我在文档上找不到任何东西。
谢谢
build.xml
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" />
<xmltask destbuffer="xml-buffer">
<fileset file="src.xml"/>
<attr path="//Connector[@protocol='HTTP/1.1']" attr="newAttribute" value="VALUE"/>
</xmltask>
<xmltask>
<print buffer="xml-buffer"/>
</xmltask>
输出
[xmltask] { buffer 'xml-buffer' output
[xmltask] <Connector newAttribute="VALUE" protocol="HTTP/1.1" redirectPort="8443"/>
[xmltask] } buffer 'xml-buffer' output