0
我有一個XML文件,我想從我的NAnt腳本中搜索Error
單詞。如果這個error
這個詞確實存在,它將回顯error exist
。如何在nant中從xml文件中搜索特定單詞?
到目前爲止我沒有找到合適的方法。有人有什麼主意嗎?
我有一個XML文件,我想從我的NAnt腳本中搜索Error
單詞。如果這個error
這個詞確實存在,它將回顯error exist
。如何在nant中從xml文件中搜索特定單詞?
到目前爲止我沒有找到合適的方法。有人有什麼主意嗎?
可能在裏面混淆${ ... }
。希望這可以幫助。
<?xml version="1.0"?>
<project name="Find a String" default="build" basedir=".">
<target name="build" description="various forms of string">
<echo message="hardcoded strings" />
<property name="stringFound" value="${string::contains('a string is a tiresome thing to search', 'tire')}" />
<echo message=" stringFound=${stringFound}" />
<echo message="property strings" />
<property name="stringToSearch" value="a property string is also a tiresome thing to search" />
<property name="findThis" value="tires" />
<property name="stringFound" value="${string::contains(stringToSearch, findThis)}"/>
<echo message=" stringFound=${stringFound}" />
</target>
</project>
這給
[echo] hardcoded strings
[echo] stringFound=True
[echo] property strings
[echo] stringFound=True
正是我需要的。謝謝 – Geddon