[英]How to read multiple attributes using xpath and based on that trigger the jenkins job
我有一個xml文件(executeRM.xml),其內容如下所述。
<r1> <n1 name="component1" version="14.0" state="ToBeInstalled"/> <n2 name="Component2" version="13.0" state="Installed"/> <n3 name="Component3" version="12.0" state="TobeInstalled"></r1>
我使用了“FS觸發器 - 監視文件”並且每隔一分鍾安排一次,我已經給出了上述xml文件的完整路徑。 現在我想編寫一個xpath查詢,只有在狀態為3個組件或全部的任何一個組件的“ToBeInstalled”時才會觸發該作業。 我編寫了下面的xpath查詢,但作業本身沒有被觸發。
/r1/n1[@name='Component1' and @state='ToBeInstalled'] /r1/n2[@name='Component2' and @state='ToBeInstalled'] /r1/n3[@name='Component3' and @state='ToBeInstalled']
根據FSTrigger的幫助:
輪詢指定XML文件的內容。 你必須給XPath表達式。 如果XPath表達式的值在2個輪詢之間發生更改,則會觸發構建。
你確定你的xPath
/r1/n1[@name='Component1' and @state='ToBeInstalled'] /r1/n2[@name='Component2' and @state='ToBeInstalled'] /r1/n3[@name='Component3' and @state='ToBeInstalled']
是正確的? 你有什么看起來像3個獨立的xPaths。
即使你只使用/r1/n1[@name='Component1' and @state='ToBeInstalled']
這只選擇n1,一個沒有文本值的節點,所以它永遠不會改變(這只是我的理論)。
例如,我只能使用/r1/n1/@state
來觸發它,但我不認為這會給你想要的控件(並且你可能會觸發多個構建)。
我認為您需要有關如何評估XPath表達式的值的更多信息。 您可以在插件站點向維護者詢問更多信息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.