Using XPath to Confirm the Existence of a Namespace
(Doc ID 1107171.1)
Last updated on APRIL 01, 2022
Applies to:APM - Application Performance Management - Version 4.5.1 to 188.8.131.52.0 [Release 4.5 to 12.1]
Information in this document applies to any platform.
Using XPath to search an XML document for a certain element or attribute by name is straight-forward. Finding a particular namespace can be trickier. Namespaces look like attributes, but they're not, so using an attribute search won't return any namespaces.
You might be tempted to use the function namespace-uri(). For example, suppose you're working with this SOAP request:
It scans the document and returns a node set of all elements that have the specified namespace. If it returns one or more nodes, that translates to a true(). If the node-list is empty, that translates to a false(). At first glance this looks good, and it will work if the namespace you're interested in is actually used to qualify at least one element. However, it's not very efficient, because it checks every element in the entire document. Furthermore, if the namespace is only defined and not used, nothing is returned.
To view full details, sign in with your My Oracle Support account.
Don't have a My Oracle Support account? Click to get started!
In this Document