Author: veithen
Date: Mon Oct 3 19:27:56 2011
New Revision: 1178526
URL: http://svn.apache.org/viewvc?rev=1178526&view=rev
Log:
Simplified some code using the new OMElement#getNamespacesInScope() API.
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/context/listener/ContextListenerUtils.java
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/context/listener/ContextListenerUtils.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/context/listener/ContextListenerUtils.java?rev=1178526&r1=1178525&r2=1178526&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/context/listener/ContextListenerUtils.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/context/listener/ContextListenerUtils.java
Mon Oct 3 19:27:56 2011
@@ -105,9 +105,8 @@ public class ContextListenerUtils {
String prefix = (ns!=null)?ns.getPrefix():null;
String uri = (ns!=null)?ns.getNamespaceURI():null;
- HashMap<String, String> nsDecls = new HashMap<String, String>();
//Get all of the namespaces associated with Body, envelope, etc
- getParentnsdeclarations(nsDecls, parent);
+ HashMap<String, String> nsDecls = getParentnsdeclarations(parent);
nsDecls.putAll(nsElementDecls);
@@ -134,23 +133,16 @@ public class ContextListenerUtils {
/*
* fetch all prent namespace declarations
*/
- private static void getParentnsdeclarations(HashMap<String, String>
nsDecls, OMContainer parent){
- if(nsDecls == null){
- nsDecls = new HashMap<String, String>();
- }
- while (parent instanceof OMElement){
- OMElement omElement = (OMElement) parent;
- Iterator ite = omElement.getAllDeclaredNamespaces();
+ private static HashMap<String, String> getParentnsdeclarations(OMContainer
parent){
+ HashMap<String, String> nsDecls = new HashMap<String, String>();
+ if (parent instanceof OMElement) {
+ Iterator ite = ((OMElement) parent).getNamespacesInScope();
while (ite.hasNext()) {
OMNamespace omn = (OMNamespace) ite.next();
- String prefix = omn.getPrefix();
- String nsUri = omn.getNamespaceURI();
- if (!nsDecls.containsKey(prefix)) {
- nsDecls.put(prefix, nsUri);
- }
+ nsDecls.put(omn.getPrefix(), omn.getNamespaceURI());
}
- parent = omElement.getParent();
}
+ return nsDecls;
}
/*
* add all parent namespace declarations to the element