SWS-329
This commit is contained in:
@@ -92,7 +92,9 @@ public class SaajContentHandler implements ContentHandler {
|
||||
for (Iterator iterator = namespaces.keySet().iterator(); iterator.hasNext();) {
|
||||
String namespacePrefix = (String) iterator.next();
|
||||
String namespaceUri = (String) namespaces.get(namespacePrefix);
|
||||
child.addNamespaceDeclaration(namespacePrefix, namespaceUri);
|
||||
if (!findParentNamespaceDeclaration(child, namespacePrefix, namespaceUri)) {
|
||||
child.addNamespaceDeclaration(namespacePrefix, namespaceUri);
|
||||
}
|
||||
}
|
||||
element = child;
|
||||
}
|
||||
@@ -101,6 +103,25 @@ public class SaajContentHandler implements ContentHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean findParentNamespaceDeclaration(SOAPElement element, String prefix, String namespaceUri) {
|
||||
String result = element.getNamespaceURI(prefix);
|
||||
if (namespaceUri.equals(result)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
try {
|
||||
SOAPElement parent = element.getParentElement();
|
||||
if (parent != null) {
|
||||
return findParentNamespaceDeclaration(parent, prefix, namespaceUri);
|
||||
}
|
||||
}
|
||||
catch (UnsupportedOperationException ex) {
|
||||
// ignore
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void endElement(String uri, String localName, String qName) throws SAXException {
|
||||
Assert.isTrue(localName.equals(element.getElementName().getLocalName()), "Invalid element on stack");
|
||||
Assert.isTrue(uri.equals(element.getElementName().getURI()), "Invalid element on stack");
|
||||
|
||||
Reference in New Issue
Block a user