public Iterator getNamespaceAxisIterator(Object contextNode)
{
if ( contextNode instanceof Element )
{
Element elem = (Element) contextNode;
Map nsMap = new HashMap();
Element current = elem;
while ( current != null ) {
Dictionary namespaces = current.getNamespaces();
if ( namespaces != null ) {
Enumeration keys = namespaces.keys();
while ( keys.hasMoreElements() ) {
String prefix = (String)keys.nextElement();
if ( !nsMap.containsKey(prefix) ) {
String uri = (String)namespaces.get(prefix);
nsMap.put( prefix,
new Namespace(elem, prefix, uri) );
}
}
}
Parent parent = current.getParent();
if ( parent instanceof Element )
current = (Element)parent;
else
break;
}