I have the following XML example:
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:custom="http://example.com/opensearchextensions/1.0/">
<ShortName>Test</ShortName>
<Description>Testing....</Description>
<Url template="whatever" type="what" />
<Query custom:color="blue" role="example" />
</OpenSearchDescription>
My concern is with Query element. It has a Namespace attribute and, in java, you will need a namespaceURI to retrieve the value.
My question is: How would I retrieve the list of namespaces from the root element (in this case, OpenSearchDescription element)? I want the attribute, prefix and namespace URI that I can use to request on Query.
Thanks.
PS: I'm using DOM in java, standard in Java SE. I'm willing to move to XPath, if it's possible. The requirement is that only the Java Standard API needs to be used.