From 22c7a331503da169b482fd5a59abf1f4b802a673 Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Wed, 6 Feb 2008 02:55:17 +0000 Subject: [PATCH] SWS-265 --- .../ws/soap/saaj/support/SaajXmlReader.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/org/springframework/ws/soap/saaj/support/SaajXmlReader.java b/core/src/main/java/org/springframework/ws/soap/saaj/support/SaajXmlReader.java index 88dd9160..57e8dcf9 100644 --- a/core/src/main/java/org/springframework/ws/soap/saaj/support/SaajXmlReader.java +++ b/core/src/main/java/org/springframework/ws/soap/saaj/support/SaajXmlReader.java @@ -166,15 +166,27 @@ public class SaajXmlReader extends AbstractXmlReader { } } + private void handleText(Text text) throws SAXException { + if (getContentHandler() != null) { + char[] ch = text.getValue().toCharArray(); + getContentHandler().characters(ch, 0, ch.length); + } + } + private Attributes getAttributes(SOAPElement element) { AttributesImpl attributes = new AttributesImpl(); + for (Iterator iterator = element.getAllAttributes(); iterator.hasNext();) { Name attributeName = (Name) iterator.next(); + String namespace = attributeName.getURI(); + if (namespace == null || !namespacesFeature) { + namespace = ""; + } String attributeValue = element.getAttributeValue(attributeName); - attributes.addAttribute(attributeName.getURI(), attributeName.getLocalName(), - attributeName.getQualifiedName(), "CDATA", attributeValue); + attributes.addAttribute(namespace, attributeName.getLocalName(), attributeName.getQualifiedName(), "CDATA", + attributeValue); } - if (namespacePrefixesFeature || !namespacesFeature) { + if (namespacePrefixesFeature) { for (Iterator iterator = element.getNamespacePrefixes(); iterator.hasNext();) { String prefix = (String) iterator.next(); String namespaceUri = element.getNamespaceURI(prefix); @@ -188,14 +200,7 @@ public class SaajXmlReader extends AbstractXmlReader { attributes.addAttribute("", "", qName, "CDATA", namespaceUri); } } - return attributes; } - private void handleText(Text text) throws SAXException { - if (getContentHandler() != null) { - char[] ch = text.getValue().toCharArray(); - getContentHandler().characters(ch, 0, ch.length); - } - } }