0
如何使用批處理文件從xml文件(build.xml)中獲取屬性值並設置條件以確定運行xml文件或不?如何從批處理文件中獲取xml的屬性值以創建運行文件的條件
我想從這個build.xml抓住以下值:
<property name="appbox1URL" value="http://10.111.111.111"/>
<property name="appbox2URL" value="http://10.222.222.222"/>
<property name="domainName" value="xxxG"/>
在我的批處理文件,我想用這些值來確定我們是否可以對運行構建文件的調用。還有一組值也被接受,以使條件成立,一個用於xxxG,另一個用於Stage。
Psudeo在批處理文件
If appbox1URL = "http://10.111.111.111" and appbox2URL = "http://10.222.222.222" and domainName = "xxxG"
OR
If appbox1URL = "http://10.111.111.000" and appbox2URL = "http://10.222.222.000" and domainName = "Stage"
THEN
call ant -buildfile "D:\xxx\Trunk\build.xml"
這是怎麼想的批處理文件編碼?
directory of build.xml - "D:\xxx\Trunk\build.xml"
directory of batchfile.bat - "D:\xxx\Trunk\Batch\batchfile.bat"
考慮XPROC或xmlsh或螞蟻。如果您爲此使用通用shell腳本,則最終會多次解析XML文件 - 甚至更糟糕的是,會多次加載Java VM。或者,將控制邏輯放在XSLT中。 –