Map namespaces = new HashMap();
for (Iterator it = element.getNamespacesInScope(); it.hasNext(); ) {
OMNamespace ns = (OMNamespace)it.next();
namespaces.put(ns.getPrefix(), ns.getNamespaceURI());
}
return new MapBasedNamespaceContext(namespaces);
} else {
return new LiveNamespaceContext(element);
}
}