xmlxpathprtg

Get value from specific attribute


I'm using PRTG and I want to monitor my parking system. The system generates a XML file and I would like to know what xPath expression I need to use, when to extract only the MODE value of the Alarmtype, for example Door

<ResponseParameters>
<Alarms>
<Alarmtype Id="Door">
<Mode>Ok</Mode>
</Alarmtype>
<Alarmtype Id="Printer">
<Mode>Failure</Mode>
</Alarmtype>
<Alarmtype Id="Barrierstate">
<Mode>Failure</Mode>
</Alarmtype>
</Alarms>
</ResponseParameters>

Solution

  • Try this expression and see if it works:

    //ResponseParameters/Alarms/Alarmtype[@Id="Door"]/Mode/text()