From d7c30f1faf71e511af9432d5bc797eb6fbd2465d Mon Sep 17 00:00:00 2001 From: slaws Date: Thu, 13 Jan 2011 14:12:04 +0000 Subject: TUSCANY-3815 - Don't add a namespace twice. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1058574 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tuscany/sca/assembly/xml/CompositeProcessor.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache') diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java index eecb07e6cd..320db7ab82 100644 --- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java +++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java @@ -1173,15 +1173,21 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt writer.writeStartElement(name.getPrefix(), name.getLocalPart(), name.getNamespaceURI()); int namespaces = reader.getNamespaceCount(); + boolean elementNamespaceAdded = false; for (int i = 0; i < namespaces; i++) { String prefix = reader.getNamespacePrefix(i); String ns = reader.getNamespaceURI(i); writer.writeNamespace(prefix, ns); + if(ns.equals(name.getNamespaceURI())){ + elementNamespaceAdded = true; + } } - - if (!"".equals(name.getNamespaceURI())) { + + if (!"".equals(name.getNamespaceURI()) && + !elementNamespaceAdded) { writer.writeNamespace(name.getPrefix(), name.getNamespaceURI()); } + // add the attributes for this element namespaces = reader.getAttributeCount(); -- cgit v1.2.3