I have this bit of XML, where I need to find the element <urn:bpInstance>
in order to transfer a value to it (for a SoapUI test):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:xxx:yyy:zzz">
<soapenv:Header/>
<soapenv:Body>
<urn:GetTaxInfo>
<urn:bpInstance/>
<urn:Id>Test123</urn:AncinitetsId>
<urn:CprNumber>123456-7890</urn:CprNummer>
<urn:FromYear>2015</urn:FraAarstal>
<urn:ToYear>2021</urn:TilAarstal>
</urn:GetTaxInfo>
</soapenv:Body>
</soapenv:Envelope>
There might be changes in the structure, so I would prefer to find it by name alone. The name will remain the same and is unique.
My first attempt was to use //urn:bpInstance
but that gives me the following error:
XPath syntax error at char 16 in {//urn:bpInstance}: Prefix urn has not been declared]
So based on this post I tried a work around where I used name()='urn:bpInstance'
instead. This does not give any errors, but it doesn't catch any elements.
The expression is applied through the SoapUI user interface, so exactly how is evaluated is unclear. You can see it in the screenshot below. It's the Target that I'm struggling with.
How do I get the element <bpInstance>
using XPath?