Reputation: 121
I have this example:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wor="http://services.tdeu.telekom.net/ServAndResMgmt/TechOrderMgmt/WorkorderProvider_v01.00"
xmlns:typ="http://services.tdeu.telekom.net/ServAndResMgmt/TechOrderMgmt/WorkorderProvider_v01.00/types"
xmlns:csdg="http://schemas.telekom.net/csdg_v01.01"
xmlns:typ1="http://system-services.t-home.telekom.de/ServiceManagement/TechnicalOrderManagement/Workorder_v01.00/types"
xmlns:com="http://system-services.t-home.telekom.de/ServiceManagement/OIS_Services_v01.00/common">
<!-- other tags -->
</soapenv:Envelope>
How to get values of "soapenv:Envelope" tag's attributes by xpath?
I tried //*:Envelope/@*[local-name()='xmlns:soapenv']
but it doesn't work
Upvotes: 0
Views: 243
Reputation: 2998
Strictly speaking, those declarations are not attributes but namespaces nodes. To get them with XPath, it depends of what version of XPath you use.
For XPath 1, use :
/*/namespace::*
For XPath 2, use : fn:in-scope-prefixes
and fn:namespace-uri-for-prefix
to get the prefix and the associated namespace uri.
Upvotes: 1