I am trying to use the XPath query tool (bottom tab in XMLSpy) to test XPaths in an XML that uses namespaces.
I don't know how to declare the namespace.
Example XML
<?xml version="1.0" encoding="UTF-8"?>
<Level1>
<Level2>
<Data xmlns="http://www.myns.com">
<Text>test</Text>
</Data>
</Level2>
</Level1>
If I select XQuery 3.1 as my query language, I can test my XPath like this:
declare namespace myns="http://www.myns.com";
//Level1/Level2/myns:Data
But if I select XPath 3.1 as my query language, how do I define the namespace? (Doing simply //Level1/Level2/Data does not work.)
Thanks.
XPath 1.0 (and higher)
or
XPath 2.0 (and higher)
XPath 3.0 or 3.1
See also this excellent answer