Project

Profile

Help

Getting Namespace declarations on a node

Added by Anonymous almost 16 years ago

Legacy ID: #5782860 Legacy Poster: David Lee (daldei)

Is there a way to get the namespace declarations which are explictly on a given node ? E.g <foo xmlns:a="http://a.com"> <bar xmlns:b="http://b.com&quot;/> </foo When I use node.axisIterator(Axis.NAMESPACE) on bar, I get both a and b. This seems like the most useful case. But if I want to only get "b" ... that is any namespace declarations which occur explicitly on a node, not all the namespaces inherited, is there a way to do that ? I've looked over quite a bit of XdmNode and NodeInfo and cant find a way. My workaround would be that on each node I build up the namespace set and manage explicitly which new ones I discover. Thanks for any suggestions.


Replies (1)

RE: Getting Namespace declarations on a node - Added by Anonymous almost 16 years ago

Legacy ID: #5782929 Legacy Poster: Michael Kay (mhkay)

At the Saxon NodeInfo level, NodeInfo.getDeclaredNamespaces() gives you essentially what you need. It's a fairly low-level interface - the result is an array of namespace codes, from which you can extract a prefix and URI by reference to the NamePool.

    (1-1/1)

    Please register to reply