I’m having problem getting the right relevance for a XML file that does not have a node. If the node exists, i can check for a value, but I’m unsure how to fail out if a node does not exists.
This works (with 3 or 1 in the id attribute) with the XML below:
exists( (child node of it) whose (node value of it =“done”) of select “status” of select “/change/computer” whose (attribute “id” of it as text = “3”) of xml document of file (“chg000099.xml”) )
It does not work if i look for a non-existing id … say 5
exists( (child node of it) whose (node value of it =“done”) of select “status” of select “/change/computer” whose (attribute “id” of it as text = “5”) of xml document of file (“chg000099.xml”) )
I get: Singular expression refers to nonexistent object.
XML file:
<?xml version="1.0" encoding="UTF-8"?>
<change number="chg000099">
<computer id="1">
<name>Server1</name>
<status>waiting</status>
</computer>
<computer id="3">
<name>Server3</name>
<status>done</status>
</computer>
</change>
Thank you for any help.