You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by ct...@apache.org on 2008/12/12 16:09:24 UTC

svn commit: r726027 [1/2] - in /webservices/muse/trunk/modules: muse-core/src/org/apache/muse/core/descriptor/ muse-core/src/org/apache/muse/core/proxy/ muse-core/src/org/apache/muse/core/routing/ muse-core/src/org/apache/muse/core/serializer/ muse-cor...

Author: ctwiner
Date: Fri Dec 12 07:09:22 2008
New Revision: 726027

URL: http://svn.apache.org/viewvc?rev=726027&view=rev
Log:
MUSE-270 patch fixes.  Includes all related patches until Eitans comment at 15 Sep 08

Modified:
    webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleCapabilityDescriptor.java
    webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleDeploymentDescriptor.java
    webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleInitParamDescriptor.java
    webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimplePersistenceDescriptor.java
    webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleResourceDescriptor.java
    webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleRouterDescriptor.java
    webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleSerializerDescriptor.java
    webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/proxy/ReflectionProxyHandler.java
    webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ReflectionMessageHandler.java
    webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/ArraySerializer.java
    webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/Base64.java
    webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/ByteArraySerializer.java
    webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/ElementSerializer.java
    webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/XmlSerializableSerializer.java
    webservices/muse/trunk/modules/muse-core/src/org/apache/muse/ws/wsdl/WsdlUtils.java
    webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiDeploymentDescriptor.java
    webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/AxisEnvironment.java
    webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XPathUtils.java
    webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XmlUtils.java
    webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/EndpointReference.java
    webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/MessageHeaders.java
    webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/soap/SoapFault.java
    webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/ComplexMatch.java
    webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/MatchCorrelation.java
    webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/QueryRelationships.java
    webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/QueryRelationshipsResponse.java
    webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleMatch.java
    webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleParticipant.java
    webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleRelationshipResource.java
    webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleRelationshipType.java
    webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleStateTransition.java
    webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleStateType.java
    webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/XPathCorrelation.java
    webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponent.java
    webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponentAddress.java
    webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleManagementEvent.java
    webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSituation.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/FilterCollection.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/GetCurrentMessage.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/GetCurrentMessageResponse.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/MessagePatternFilter.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/NotificationMessageSerializer.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/ProducerPropertiesFilter.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationMessage.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleSubscriptionManager.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/Subscribe.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SubscribeResponse.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/TopicFilter.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/properties/ResourcePropertyChangeEvent.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/remote/NotificationConsumerClient.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/remote/NotificationProducerClient.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/topics/impl/SimpleTopic.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/topics/impl/SimpleTopicNamespace.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/topics/impl/SimpleTopicSet.java
    webservices/muse/trunk/modules/muse-wsrf-api/src/org/apache/muse/ws/resource/metadata/OpenMetadataDescriptor.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/lifetime/impl/SetTerminationTime.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/lifetime/impl/SetTerminationTimeResponse.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/metadata/impl/PropertyMetadata.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/metadata/impl/SimpleMetadataDescriptor.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/metadata/impl/WsrmdUtils.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/get/impl/GetMultipleRequest.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/get/impl/GetMultipleResponse.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/get/impl/GetRequest.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/get/impl/GetResponse.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/impl/SimpleResourcePropertyCollection.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/query/impl/QueryRequest.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/query/impl/QueryResponse.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/set/impl/DeleteRequest.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/set/impl/InsertRequest.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/set/impl/SimpleSetRequest.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/set/impl/UpdateRequest.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/remote/WsResourceClient.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/sg/impl/AddRequest.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/sg/impl/AddResponse.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/sg/impl/SimpleEntry.java
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/sg/impl/SimpleMembershipContentRule.java
    webservices/muse/trunk/modules/muse-wsx-impl/src/org/apache/muse/ws/metadata/impl/GetMetadataRequest.java
    webservices/muse/trunk/modules/muse-wsx-impl/src/org/apache/muse/ws/metadata/impl/GetMetadataResponse.java

Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleCapabilityDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleCapabilityDescriptor.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleCapabilityDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleCapabilityDescriptor.java Fri Dec 12 07:09:22 2008
@@ -113,7 +113,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleDeploymentDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleDeploymentDescriptor.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleDeploymentDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleDeploymentDescriptor.java Fri Dec 12 07:09:22 2008
@@ -196,7 +196,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleInitParamDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleInitParamDescriptor.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleInitParamDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleInitParamDescriptor.java Fri Dec 12 07:09:22 2008
@@ -72,7 +72,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimplePersistenceDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimplePersistenceDescriptor.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimplePersistenceDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimplePersistenceDescriptor.java Fri Dec 12 07:09:22 2008
@@ -109,7 +109,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleResourceDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleResourceDescriptor.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleResourceDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleResourceDescriptor.java Fri Dec 12 07:09:22 2008
@@ -422,7 +422,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleRouterDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleRouterDescriptor.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleRouterDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleRouterDescriptor.java Fri Dec 12 07:09:22 2008
@@ -165,7 +165,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleSerializerDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleSerializerDescriptor.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleSerializerDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleSerializerDescriptor.java Fri Dec 12 07:09:22 2008
@@ -106,7 +106,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/proxy/ReflectionProxyHandler.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/proxy/ReflectionProxyHandler.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/proxy/ReflectionProxyHandler.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/proxy/ReflectionProxyHandler.java Fri Dec 12 07:09:22 2008
@@ -208,7 +208,7 @@
         for (int n = 0; n < inputParts.length; ++n)
         {
             Element child = serialize(parameters[n], inputParts[n]);            
-            root.appendChild(child);
+            root.appendChild(root.getOwnerDocument().importNode( child, true));
         }
         
         return root;

Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ReflectionMessageHandler.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ReflectionMessageHandler.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ReflectionMessageHandler.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ReflectionMessageHandler.java Fri Dec 12 07:09:22 2008
@@ -199,7 +199,7 @@
         // for complex types, we need a child element under the 
         // response body element
         //
-        Element valueXML = ser.toXML(result, returnValueName);
+        Element valueXML = (Element) responseXML.getOwnerDocument().importNode(ser.toXML(result, returnValueName), true);
         
         //
         // for arrays, we put the children (array items) under the 

Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/ArraySerializer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/ArraySerializer.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/ArraySerializer.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/ArraySerializer.java Fri Dec 12 07:09:22 2008
@@ -176,7 +176,7 @@
         {
             Object item = Array.get(obj, n);
             Element child = serializer.toXML(item, qname);            
-            root.appendChild(child);
+            root.appendChild( root.getOwnerDocument().importNode( child, true) );
         }
         
         return root;

Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/Base64.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/Base64.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/Base64.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/Base64.java Fri Dec 12 07:09:22 2008
@@ -1,182 +1,182 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- * 
- */
-
-/*
- * Copyright (c) 2002,2003, Stefan Haustein, Oberhausen, Rhld., Germany
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- * 
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- * 
- */
-
-package org.apache.muse.core.serializer;
-
-import java.io.*;
-
-class Base64
-{    
-    static final char[] charTab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
-    
-    public static String encode(byte[] data, boolean isChunked)
-    {
-        return encode(data, 0, data.length, isChunked, null).toString();
-    }
-    
-    /**
-     * Encodes the part of the given byte array denoted by start and len to the
-     * Base64 format. The encoded data is appended to the given StringBuffer. If
-     * no StringBuffer is given, a new one is created automatically. The
-     * StringBuffer is the return value of this method.
-     */
-    
-    public static StringBuffer encode(byte[] data, int start, int len, boolean isChunked, StringBuffer buf)
-    {        
-        if (buf == null)
-            buf = new StringBuffer(data.length * 3 / 2);
-        
-        int end = len - 3;
-        int i = start;
-        int n = 0;
-        
-        while (i <= end)
-        {
-            int d = (((data[i]) & 0x0ff) << 16) | (((data[i + 1]) & 0x0ff) << 8) | ((data[i + 2]) & 0x0ff);
-            
-            buf.append(charTab[(d >> 18) & 63]);
-            buf.append(charTab[(d >> 12) & 63]);
-            buf.append(charTab[(d >> 6) & 63]);
-            buf.append(charTab[d & 63]);
-            
-            i += 3;
-            
-            if (isChunked)
-            {
-                if (n++ >= 14)
-                {
-                    n = 0;
-                    buf.append("\r\n");
-                }
-            }
-        }
-        
-        if (i == start + len - 2)
-        {
-            int d = (((data[i]) & 0x0ff) << 16) | (((data[i + 1]) & 255) << 8);
-            
-            buf.append(charTab[(d >> 18) & 63]);
-            buf.append(charTab[(d >> 12) & 63]);
-            buf.append(charTab[(d >> 6) & 63]);
-            buf.append("=");
-        }
-        else if (i == start + len - 1)
-        {
-            int d = ((data[i]) & 0x0ff) << 16;
-            
-            buf.append(charTab[(d >> 18) & 63]);
-            buf.append(charTab[(d >> 12) & 63]);
-            buf.append("==");
-        }
-        
-        return buf;
-    }
-    
-    static int decode(char c)
-    {
-        if (c >= 'A' && c <= 'Z')
-            return c - 65;
-        else if (c >= 'a' && c <= 'z')
-            return c - 97 + 26;
-        else if (c >= '0' && c <= '9')
-            return c - 48 + 26 + 26;
-        else
-            switch (c)
-            {
-                case '+':
-                    return 62;
-                case '/':
-                    return 63;
-                case '=':
-                    return 0;
-                default:
-                    throw new RuntimeException("unexpected code: " + c);
-            }
-    }
-    
-    /**
-     * Decodes the given Base64 encoded String to a new byte array. The byte
-     * array holding the decoded data is returned.
-     */
-    public static byte[] decode(String s)
-    {        
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        
-        try
-        {
-            decode(s, bos);
-        }
-        catch (IOException e)
-        {
-            throw new RuntimeException();
-        }
-        
-        return bos.toByteArray();
-    }
-    
-    public static void decode(String s, OutputStream os) throws IOException
-    {
-        int i = 0;
-        
-        int len = s.length();
-        
-        while (true)
-        {
-            while (i < len && s.charAt(i) <= ' ')
-                i++;
-            
-            if (i == len)
-                break;
-            
-            int tri = (decode(s.charAt(i)) << 18) + (decode(s.charAt(i + 1)) << 12) + (decode(s.charAt(i + 2)) << 6) + (decode(s.charAt(i + 3)));
-            
-            os.write((tri >> 16) & 255);
-            if (s.charAt(i + 2) == '=')
-                break;
-            os.write((tri >> 8) & 255);
-            if (s.charAt(i + 3) == '=')
-                break;
-            os.write(tri & 255);
-            
-            i += 4;
-        }
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ * 
+ */
+
+/*
+ * Copyright (c) 2002,2003, Stefan Haustein, Oberhausen, Rhld., Germany
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ * 
+ */
+
+package org.apache.muse.core.serializer;
+
+import java.io.*;
+
+class Base64
+{    
+    static final char[] charTab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
+    
+    public static String encode(byte[] data, boolean isChunked)
+    {
+        return encode(data, 0, data.length, isChunked, null).toString();
+    }
+    
+    /**
+     * Encodes the part of the given byte array denoted by start and len to the
+     * Base64 format. The encoded data is appended to the given StringBuffer. If
+     * no StringBuffer is given, a new one is created automatically. The
+     * StringBuffer is the return value of this method.
+     */
+    
+    public static StringBuffer encode(byte[] data, int start, int len, boolean isChunked, StringBuffer buf)
+    {        
+        if (buf == null)
+            buf = new StringBuffer(data.length * 3 / 2);
+        
+        int end = len - 3;
+        int i = start;
+        int n = 0;
+        
+        while (i <= end)
+        {
+            int d = (((data[i]) & 0x0ff) << 16) | (((data[i + 1]) & 0x0ff) << 8) | ((data[i + 2]) & 0x0ff);
+            
+            buf.append(charTab[(d >> 18) & 63]);
+            buf.append(charTab[(d >> 12) & 63]);
+            buf.append(charTab[(d >> 6) & 63]);
+            buf.append(charTab[d & 63]);
+            
+            i += 3;
+            
+            if (isChunked)
+            {
+                if (n++ >= 14)
+                {
+                    n = 0;
+                    buf.append("\r\n");
+                }
+            }
+        }
+        
+        if (i == start + len - 2)
+        {
+            int d = (((data[i]) & 0x0ff) << 16) | (((data[i + 1]) & 255) << 8);
+            
+            buf.append(charTab[(d >> 18) & 63]);
+            buf.append(charTab[(d >> 12) & 63]);
+            buf.append(charTab[(d >> 6) & 63]);
+            buf.append("=");
+        }
+        else if (i == start + len - 1)
+        {
+            int d = ((data[i]) & 0x0ff) << 16;
+            
+            buf.append(charTab[(d >> 18) & 63]);
+            buf.append(charTab[(d >> 12) & 63]);
+            buf.append("==");
+        }
+        
+        return buf;
+    }
+    
+    static int decode(char c)
+    {
+        if (c >= 'A' && c <= 'Z')
+            return c - 65;
+        else if (c >= 'a' && c <= 'z')
+            return c - 97 + 26;
+        else if (c >= '0' && c <= '9')
+            return c - 48 + 26 + 26;
+        else
+            switch (c)
+            {
+                case '+':
+                    return 62;
+                case '/':
+                    return 63;
+                case '=':
+                    return 0;
+                default:
+                    throw new RuntimeException("unexpected code: " + c);
+            }
+    }
+    
+    /**
+     * Decodes the given Base64 encoded String to a new byte array. The byte
+     * array holding the decoded data is returned.
+     */
+    public static byte[] decode(String s)
+    {        
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        
+        try
+        {
+            decode(s, bos);
+        }
+        catch (IOException e)
+        {
+            throw new RuntimeException();
+        }
+        
+        return bos.toByteArray();
+    }
+    
+    public static void decode(String s, OutputStream os) throws IOException
+    {
+        int i = 0;
+        
+        int len = s.length();
+        
+        while (true)
+        {
+            while (i < len && s.charAt(i) <= ' ')
+                i++;
+            
+            if (i == len)
+                break;
+            
+            int tri = (decode(s.charAt(i)) << 18) + (decode(s.charAt(i + 1)) << 12) + (decode(s.charAt(i + 2)) << 6) + (decode(s.charAt(i + 3)));
+            
+            os.write((tri >> 16) & 255);
+            if (s.charAt(i + 2) == '=')
+                break;
+            os.write((tri >> 8) & 255);
+            if (s.charAt(i + 3) == '=')
+                break;
+            os.write(tri & 255);
+            
+            i += 4;
+        }
+    }
+}

Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/ByteArraySerializer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/ByteArraySerializer.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/ByteArraySerializer.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/ByteArraySerializer.java Fri Dec 12 07:09:22 2008
@@ -1,55 +1,55 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.muse.core.serializer;
-
-import javax.xml.namespace.QName;
-
-import org.w3c.dom.Element;
-
-import org.apache.muse.util.xml.XmlUtils;
-
-/**
- *
- * ByteArraySerializer transforms bytes to XML using base64 encoding (xsd:base64Binary) and back.
- *
- * @author Alberto Rodriguez (alberto.rodriguez at eUSA.net)
- *
- */
-
-public class ByteArraySerializer implements Serializer
-{
-    public Object fromXML(Element xml)
-    {
-        String text = XmlUtils.extractText(xml);
-        return text == null ? null : Base64.decode(text);
-    }
-    
-    public Class getSerializableType()
-    {
-        return byte[].class;
-    }
-    
-    public Element toXML(Object obj, QName qname)
-    {
-        String encoded = Base64.encode((byte[])obj, false);
-        return XmlUtils.createElement(qname, encoded);
-    }
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.muse.core.serializer;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.util.xml.XmlUtils;
+
+/**
+ *
+ * ByteArraySerializer transforms bytes to XML using base64 encoding (xsd:base64Binary) and back.
+ *
+ * @author Alberto Rodriguez (alberto.rodriguez at eUSA.net)
+ *
+ */
+
+public class ByteArraySerializer implements Serializer
+{
+    public Object fromXML(Element xml)
+    {
+        String text = XmlUtils.extractText(xml);
+        return text == null ? null : Base64.decode(text);
+    }
+    
+    public Class getSerializableType()
+    {
+        return byte[].class;
+    }
+    
+    public Element toXML(Object obj, QName qname)
+    {
+        String encoded = Base64.encode((byte[])obj, false);
+        return XmlUtils.createElement(qname, encoded);
+    }
+}

Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/ElementSerializer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/ElementSerializer.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/ElementSerializer.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/ElementSerializer.java Fri Dec 12 07:09:22 2008
@@ -56,9 +56,6 @@
         
         QName currentName = XmlUtils.getElementQName((Element)obj);
         
-        if (currentName.equals(qname))
-            return (Element)XmlUtils.convertToNode(XmlUtils.EMPTY_DOC, obj);
-        
-        return XmlUtils.createElement(XmlUtils.EMPTY_DOC, qname, obj);
+        return XmlUtils.createElement(XmlUtils.createDocument(), qname, obj);
     }
 }

Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/XmlSerializableSerializer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/XmlSerializableSerializer.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/XmlSerializableSerializer.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/XmlSerializableSerializer.java Fri Dec 12 07:09:22 2008
@@ -66,6 +66,6 @@
             return XmlUtils.createElement(qname);
         
         Element xml = ((XmlSerializable)obj).toXML();
-        return XmlUtils.createElement(XmlUtils.EMPTY_DOC, qname, xml);
+        return XmlUtils.createElement(XmlUtils.createDocument(), qname, xml);
     }
 }

Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/ws/wsdl/WsdlUtils.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/ws/wsdl/WsdlUtils.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/ws/wsdl/WsdlUtils.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/ws/wsdl/WsdlUtils.java Fri Dec 12 07:09:22 2008
@@ -680,7 +680,7 @@
         // empty output message also = pack simple return value into
         // response element (or void)
         //
-        if (typeDef.getChildNodes().getLength() == 0)
+        if (typeDef.getFirstChild() == null)
             return null;
 
         Element returnValueElement = XmlUtils.findFirstInSubTree(typeDef, XsdUtils.ELEMENT_QNAME);

Modified: webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiDeploymentDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiDeploymentDescriptor.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiDeploymentDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiDeploymentDescriptor.java Fri Dec 12 07:09:22 2008
@@ -304,7 +304,7 @@
     }
     
     public Element toXML() {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
     
     public Element toXML(Document doc) {

Modified: webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/AxisEnvironment.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/AxisEnvironment.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/AxisEnvironment.java (original)
+++ webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/AxisEnvironment.java Fri Dec 12 07:09:22 2008
@@ -190,7 +190,7 @@
         while (i.hasNext())
         {
             Element child = convertToDOM((OMElement)i.next());
-            dom.appendChild(child);
+            dom.appendChild( dom.getOwnerDocument().importNode( child, true ) );
         }
 
         return dom;

Modified: webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XPathUtils.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XPathUtils.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XPathUtils.java (original)
+++ webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XPathUtils.java Fri Dec 12 07:09:22 2008
@@ -116,7 +116,7 @@
         // otherwise, it's a scalar - turn it into a text node
         //
         String resultValue = result.str();
-        Node resultNode = XmlUtils.EMPTY_DOC.createTextNode(resultValue);
+        Node resultNode = XmlUtils.createDocument().createTextNode(resultValue);
         return new Node[]{ resultNode };
     }
     

Modified: webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XmlUtils.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XmlUtils.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XmlUtils.java (original)
+++ webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XmlUtils.java Fri Dec 12 07:09:22 2008
@@ -31,6 +31,7 @@
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -64,16 +65,48 @@
 public class XmlUtils
 {    
     /**
+	 * Iterator over nodes, fully typed.
      * 
-     * An empty Document that can be used as a DOM factory for creation of 
-     * random XML fragments. This should NOT be used by callers that want 
-     * to build new fragments and attach them to a Document - this is merely 
-     * a scratch pad for creating new DOM components without having to make 
-     * a new Document each time. There are no guarantees as to the content 
-     * of the empty Document, but you should <b>never</b> append children.
+	 * @author Chris Twiner (ctwiner)
      * 
      */
-    public static final Document EMPTY_DOC;
+    public static class NodeChildrenIterator {
+    	final Node parent;
+    	private Node current = null;
+    	
+    	public NodeChildrenIterator(Node parent) {
+    		this.parent = parent;
+    		if (parent != null) {
+    			current = parent.getFirstChild();
+    		}
+		}
+    	
+    	public boolean hasNext() {
+    		return (current!=null);
+    	}
+    	
+    	public Node next(){
+    		if (current == null) return null;
+    		
+    		Node res = current;
+    		// move on to the next one
+    		current = current.getNextSibling();
+    		return res;
+    	}
+    	
+    	public void remove(){
+    		if (current == null) return;
+    		
+    		// get next
+    		Node next = current.getNextSibling();
+    		
+    		// remove exisiting
+    		parent.removeChild(current);
+    		
+    		// should be either next or null, not back to first etc.
+    		current = next;
+    	}
+    }
     
     /**
      * 
@@ -105,21 +138,6 @@
 
     /**
      * 
-     * The static constructor initializes the DOM DocumentBuilder that is 
-     * used to create all new DOM Documents. It also creates the scratchpad
-     * Document available to all user code (EMPTY_DOC).
-     * 
-     */
-    static 
-    {        
-        //
-        // create the 'scratch pad' for making random DOM components
-        //
-        EMPTY_DOC = createDocument();
-    }
-    
-    /**
-     * 
      * @param list
      *        The list of Nodes to copy into a Node array.
      * 
@@ -139,6 +157,26 @@
     
     /**
      * 
+     * @param parent
+     *        The parent node from which to copy the children into a Node array.
+     * 
+     * @return An array holding a copy of the child Nodes from the original parent.
+     *
+     */
+    public static Node[] convertToArray(Node parent)
+    {
+    	ArrayList list = new ArrayList();
+    	NodeChildrenIterator itr = new NodeChildrenIterator(parent);
+    	while (itr.hasNext()) {
+			Node child = itr.next();
+			list.add(child);
+	    }
+        
+        return (Node[]) list.toArray(new Node[list.size()]);
+    }
+    
+    /**
+     * 
      * Converts an object into its XML representation; this usually means 
      * that the object's toString() method is called and the result used 
      * to create a DOM Text object. Special consideration is given to the 
@@ -200,42 +238,63 @@
     /**
      * 
      * @return A new DocumentBuilder, which can be used to parse XML 
-     *         by <b>a single thread.</b> Parsing methods should use 
-     *         this method to create a new builder for every operation 
-     *         because DocumentBuilder.parse() is <b>not</b> thread-safe.
-     *
-     */
-    private static DocumentBuilder createBuilder()
-    {
-        //
-        // create the builder that will be shared throughout the process
-        //
-        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-        
-        //
-        // don't forget - turn on namespaces!!!
-        //
-        factory.setNamespaceAware(true);
-        
-        //
-        // we don't need comment nodes - they'll only slow us down
-        //
-        factory.setIgnoringComments(true);
-        
-        try
-        {
-            return factory.newDocumentBuilder();
-        }
-        
-        //
-        // this exception would be thrown if you have the DOM interfaces 
-        // but not the implementation
-        //
-        catch (ParserConfigurationException error)
-        {
-            throw new RuntimeException(error.getMessage(), error);
-        }
-    }
+     *         by <b>a single thread.</b> Because DocumentBuilder.parse() is <b>not</b> thread-safe
+     *         the calling code should not share the document builder (or its Documents) across threads.
+     *         The backing ThreadLocal ensures quick re-use, as such this function should be called for each
+     *         operation on a DocumentBuilder.
+     *
+     */
+    private static DocumentBuilder createBuilder() {
+    	return (DocumentBuilder)tls.get();
+    }
+    
+    private static final ThreadLocal tls = new ThreadLocal(){
+    	
+    	// CTw for handling code that sets the context classloader when the TLS is used from a different thread context classloader.
+        // "this" is used as the initialization occurs on the correct classloader. The current context classloader also can't be garaunteed.
+        ClassLoader cl = Thread.currentThread().getContextClassLoader(); 
+    	
+		protected Object initialValue() {
+
+			// CTw fix for classloaders
+			ClassLoader ct = Thread.currentThread().getContextClassLoader();
+			Thread.currentThread().setContextClassLoader(cl);
+			try{ 
+				
+				//1
+		        // create the builder that will be shared throughout the process
+		        //
+		        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+		        
+		        //
+		        // don't forget - turn on namespaces!!!
+		        //
+		        factory.setNamespaceAware(true);
+		        
+		        //
+		        // we don't need comment nodes - they'll only slow us down
+		        //
+		        factory.setIgnoringComments(true);
+		        
+		        try
+		        {
+		            return factory.newDocumentBuilder();
+		        }
+		        
+		        //
+		        // this exception would be thrown if you have the DOM interfaces 
+		        // but not the implementation
+		        //
+		        catch (ParserConfigurationException error)
+		        {
+		            throw new RuntimeException(error.getMessage(), error);
+		        }
+			} finally {
+				// reset it
+				Thread.currentThread().setContextClassLoader(ct); 
+			}
+		}
+	};
     
     /**
      *
@@ -525,14 +584,11 @@
             //
             // now add the child elements
             //
-            NodeList children = value.getChildNodes();
-            int length = children.getLength();
             
-            for (int n = 0; n < length; ++n)
-            {
-                Node next = children.item(n);
-                next = doc.importNode(next, true);
-                root.appendChild(next);
+            NodeChildrenIterator itr = new NodeChildrenIterator(value);
+        	while (itr.hasNext()) {
+    			Node nextChild = doc.importNode(itr.next(), true);
+                root.appendChild(nextChild);
             }
         }
         
@@ -599,15 +655,14 @@
     /**
      *
      * This is a convenience method that creates a new Element with the 
-     * given value; the owner of the Element is EMPTY_DOC.
+     * given value; the owner of the Element is an EMPTY_DOC.
      * 
-     * @see #EMPTY_DOC
      * @see #createElement(Document, QName, Object) 
      *
      */
     public static Element createElement(QName qname, Object value)
     {
-        return createElement(EMPTY_DOC, qname, value);
+        return createElement(createDocument(), qname, value);
     }
     
     /**
@@ -699,16 +754,13 @@
      */
     public static String extractText(Element element)
     {
-        NodeList children = element.getChildNodes();
-        int length = children.getLength();
-        
         //
         // have to check all nodes, because we could have text 
         // mixed with elements
         //
-        for (int n = 0; n < length; ++n)
-        {
-            Node next = children.item(n);
+        NodeChildrenIterator itr = new NodeChildrenIterator(element);
+    	while (itr.hasNext()) {
+			Node next = itr.next();
             
             //
             // note that we remove all leading/trailing whitespace
@@ -716,7 +768,6 @@
             if (next.getNodeType() == Node.TEXT_NODE)
                 return next.getNodeValue().trim();            
         }
-        
         return null;
     }
     
@@ -900,19 +951,11 @@
         boolean matchAllNames = localName.equals("*");
         boolean matchAllNamespaces = namespace.equals("*");
         
-        NodeList children = context.getChildNodes();
-        int totalLength = children.getLength();
-        
-        List elements = new ArrayList(totalLength);
-        
-        for (int n = 0; n < totalLength; ++n)
-        {
-            //
-            // the context root may have child nodes that are not 
-            // Elements, so we have to check
-            //
-            Node next = children.item(n);
+        List elements = new ArrayList();
             
+        NodeChildrenIterator itr = new NodeChildrenIterator(context);
+    	while (itr.hasNext()) {
+			Node next = itr.next();
             //
             // first check - is it an Element?
             //
@@ -1474,19 +1517,11 @@
         // should match
         //
         
-        NodeList children1 = e1.getChildNodes();
-        NodeList children2 = e2.getChildNodes();
-        
-        int length1 = children1.getLength();
-        int length2 = children2.getLength();
-        
-        if (length1 != length2)
-            return false;
-        
-        for (int n = 0; n < length1; ++n)
-        {
-            Node next1 = children1.item(n);
-            Node next2 = children2.item(n);
+        NodeChildrenIterator itr1 = new NodeChildrenIterator(e1);
+        NodeChildrenIterator itr2 = new NodeChildrenIterator(e2);
+        while (itr1.hasNext() && itr2.hasNext()) {
+            Node next1 = itr1.next();
+            Node next2 = itr2.next();
             
             short type1 = next1.getNodeType();
             short type2 = next2.getNodeType();
@@ -1519,6 +1554,12 @@
                 return false;
         }
         
+        // extra test incase more children (was previously covered by a children.getLength)
+        if (itr1.hasNext() != itr2.hasNext()) {
+        	// means one has more children than the other
+        	return false;
+        }
+        
         return true;
     }
     
@@ -1566,8 +1607,7 @@
      */
 	public static Node moveSubTree(Node from, Node to, Node context) 
     {
-        NodeList children = from.getChildNodes();
-        Node[] asArray = convertToArray(children);
+        Node[] asArray = convertToArray(from);
         
         Document fromDoc = from.getOwnerDocument();
         Document toDoc = to.getOwnerDocument();
@@ -1814,16 +1854,12 @@
     {
         Node currentTextNode = null;
         
-        NodeList children = element.getChildNodes();
-        int length = children.getLength();
-        
         //
         // first check to see if we already have text in the element
         //
-        for (int n = 0; n < length && currentTextNode == null; ++n)
-        {
-            Node next = children.item(n);
-            
+        NodeChildrenIterator itr = new NodeChildrenIterator(element);
+        while(itr.hasNext() && currentTextNode == null) {
+        	Node next = itr.next();
             if (next.getNodeType() == Node.TEXT_NODE)
                 currentTextNode = next;
         }

Modified: webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/EndpointReference.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/EndpointReference.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/EndpointReference.java (original)
+++ webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/EndpointReference.java Fri Dec 12 07:09:22 2008
@@ -24,16 +24,14 @@
 
 import javax.xml.namespace.QName;
 
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
 import org.apache.muse.util.messages.Messages;
 import org.apache.muse.util.messages.MessagesFactory;
 import org.apache.muse.util.xml.XmlSerializable;
 import org.apache.muse.util.xml.XmlUtils;
 import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
 
 /**
  *
@@ -121,7 +119,7 @@
         // option #1 - make our own copy of the XML sub-tree
         //
         if (makeDeepCopyOfXML)
-            _xml = (Element)XmlUtils.EMPTY_DOC.importNode(root, true);
+            _xml = (Element)XmlUtils.createDocument().importNode(root, true);
         
         //
         // option #2 - just use the existing fragment
@@ -172,19 +170,16 @@
         // create the root element - we can't just importNode because the 
         // QName might be different
         //
-        Document doc = XmlUtils.EMPTY_DOC;
+        Document doc = XmlUtils.createDocument();
         _xml = XmlUtils.createElement(doc, typeName);
         
         //
         // now copy all child elements...
         //
-        NodeList children = copy.toXML().getChildNodes();
-        int length = children.getLength();
-        
-        for (int n = 0; n < length; ++n)
-        {
-            Node next = doc.importNode(children.item(n), true);
-            _xml.appendChild(next);
+        XmlUtils.NodeChildrenIterator itr = new XmlUtils.NodeChildrenIterator(copy.toXML());
+        while(itr.hasNext()) {
+            Node imp = doc.importNode(itr.next(), true);
+            _xml.appendChild(imp);
         }
         
         try
@@ -236,7 +231,7 @@
         
         _address = address;
         
-        Document doc = XmlUtils.EMPTY_DOC;        
+        Document doc = XmlUtils.createDocument();        
         _xml = XmlUtils.createElement(doc, typeName);
         
         //
@@ -387,14 +382,15 @@
     }
     
     /**
-     *
+     * For reasons of thread safety this value is calculated.  For performance, if the parameters
+     * themselves are used then retrieve the length from the getParameters array-
      * @return The current number of elements in the wsa:ReferenceParameters 
      *         section.
      *
      */
     public int getNumberOfParameters()
     {
-        return _parameters.getChildNodes().getLength();
+    	return getParameters().length;
     }
     
     /**

Modified: webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/MessageHeaders.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/MessageHeaders.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/MessageHeaders.java (original)
+++ webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/MessageHeaders.java Fri Dec 12 07:09:22 2008
@@ -697,7 +697,7 @@
      */
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
     
     /**

Modified: webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/soap/SoapFault.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/soap/SoapFault.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/soap/SoapFault.java (original)
+++ webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/soap/SoapFault.java Fri Dec 12 07:09:22 2008
@@ -157,7 +157,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/ComplexMatch.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/ComplexMatch.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/ComplexMatch.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/ComplexMatch.java Fri Dec 12 07:09:22 2008
@@ -152,7 +152,7 @@
     
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
     
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/MatchCorrelation.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/MatchCorrelation.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/MatchCorrelation.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/MatchCorrelation.java Fri Dec 12 07:09:22 2008
@@ -177,7 +177,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/QueryRelationships.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/QueryRelationships.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/QueryRelationships.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/QueryRelationships.java Fri Dec 12 07:09:22 2008
@@ -79,7 +79,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document factory)

Modified: webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/QueryRelationshipsResponse.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/QueryRelationshipsResponse.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/QueryRelationshipsResponse.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/QueryRelationshipsResponse.java Fri Dec 12 07:09:22 2008
@@ -92,7 +92,7 @@
 
     public Element toXML()
     {
-        return toXML(org.apache.muse.util.xml.XmlUtils.EMPTY_DOC);
+        return toXML(org.apache.muse.util.xml.XmlUtils.createDocument());
     }
 
     public Element toXML(Document factory)

Modified: webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleMatch.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleMatch.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleMatch.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleMatch.java Fri Dec 12 07:09:22 2008
@@ -228,7 +228,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleParticipant.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleParticipant.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleParticipant.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleParticipant.java Fri Dec 12 07:09:22 2008
@@ -265,7 +265,7 @@
     
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
     
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleRelationshipResource.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleRelationshipResource.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleRelationshipResource.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleRelationshipResource.java Fri Dec 12 07:09:22 2008
@@ -105,7 +105,7 @@
     
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
     
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleRelationshipType.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleRelationshipType.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleRelationshipType.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleRelationshipType.java Fri Dec 12 07:09:22 2008
@@ -87,7 +87,7 @@
     
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
     
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleStateTransition.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleStateTransition.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleStateTransition.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleStateTransition.java Fri Dec 12 07:09:22 2008
@@ -171,7 +171,7 @@
     
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
     
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleStateType.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleStateType.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleStateType.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/SimpleStateType.java Fri Dec 12 07:09:22 2008
@@ -87,7 +87,7 @@
     
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
     
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/XPathCorrelation.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/XPathCorrelation.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/XPathCorrelation.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-muws-impl/src/org/apache/muse/ws/dm/muws/impl/XPathCorrelation.java Fri Dec 12 07:09:22 2008
@@ -231,7 +231,7 @@
     
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponent.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponent.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponent.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponent.java Fri Dec 12 07:09:22 2008
@@ -106,7 +106,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document factory)

Modified: webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponentAddress.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponentAddress.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponentAddress.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleComponentAddress.java Fri Dec 12 07:09:22 2008
@@ -50,7 +50,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document factory)

Modified: webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleManagementEvent.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleManagementEvent.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleManagementEvent.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleManagementEvent.java Fri Dec 12 07:09:22 2008
@@ -213,7 +213,7 @@
     
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSituation.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSituation.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSituation.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-wef-impl/src/org/apache/muse/ws/dm/muws/events/impl/SimpleSituation.java Fri Dec 12 07:09:22 2008
@@ -223,7 +223,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document factory)

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/FilterCollection.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/FilterCollection.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/FilterCollection.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/FilterCollection.java Fri Dec 12 07:09:22 2008
@@ -80,7 +80,7 @@
     
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
     
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/GetCurrentMessage.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/GetCurrentMessage.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/GetCurrentMessage.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/GetCurrentMessage.java Fri Dec 12 07:09:22 2008
@@ -69,7 +69,7 @@
     
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
     
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/GetCurrentMessageResponse.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/GetCurrentMessageResponse.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/GetCurrentMessageResponse.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/GetCurrentMessageResponse.java Fri Dec 12 07:09:22 2008
@@ -67,7 +67,7 @@
     
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
     
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/MessagePatternFilter.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/MessagePatternFilter.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/MessagePatternFilter.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/MessagePatternFilter.java Fri Dec 12 07:09:22 2008
@@ -98,7 +98,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/NotificationMessageSerializer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/NotificationMessageSerializer.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/NotificationMessageSerializer.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/NotificationMessageSerializer.java Fri Dec 12 07:09:22 2008
@@ -57,6 +57,6 @@
             return XmlUtils.createElement(qname);
         
         Element msgXML = ((NotificationMessage)obj).toXML();
-        return XmlUtils.createElement(XmlUtils.EMPTY_DOC, qname, msgXML, false);
+        return XmlUtils.createElement(XmlUtils.createDocument(), qname, msgXML, false);
     }
 }

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/ProducerPropertiesFilter.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/ProducerPropertiesFilter.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/ProducerPropertiesFilter.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/ProducerPropertiesFilter.java Fri Dec 12 07:09:22 2008
@@ -118,7 +118,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationMessage.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationMessage.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationMessage.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationMessage.java Fri Dec 12 07:09:22 2008
@@ -236,7 +236,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleSubscriptionManager.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleSubscriptionManager.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleSubscriptionManager.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleSubscriptionManager.java Fri Dec 12 07:09:22 2008
@@ -329,7 +329,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/Subscribe.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/Subscribe.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/Subscribe.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/Subscribe.java Fri Dec 12 07:09:22 2008
@@ -142,7 +142,7 @@
     
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
     
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SubscribeResponse.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SubscribeResponse.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SubscribeResponse.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SubscribeResponse.java Fri Dec 12 07:09:22 2008
@@ -118,7 +118,7 @@
     
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
     
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/TopicFilter.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/TopicFilter.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/TopicFilter.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/TopicFilter.java Fri Dec 12 07:09:22 2008
@@ -166,7 +166,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/properties/ResourcePropertyChangeEvent.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/properties/ResourcePropertyChangeEvent.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/properties/ResourcePropertyChangeEvent.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/properties/ResourcePropertyChangeEvent.java Fri Dec 12 07:09:22 2008
@@ -93,7 +93,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/remote/NotificationConsumerClient.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/remote/NotificationConsumerClient.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/remote/NotificationConsumerClient.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/remote/NotificationConsumerClient.java Fri Dec 12 07:09:22 2008
@@ -93,9 +93,9 @@
         
         Element notify = XmlUtils.createElement(WsnConstants.NOTIFY_QNAME);
         
-        for (int n = 0; n < messages.length; ++n)
-            notify.appendChild(messages[n].toXML());
-        
+        for (int n = 0; n < messages.length; ++n) {
+        	notify.appendChild(messages[n].toXML(notify.getOwnerDocument()));
+        }
         invoke(WsnConstants.NOTIFY_URI, notify);
     }
 }

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/remote/NotificationProducerClient.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/remote/NotificationProducerClient.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/remote/NotificationProducerClient.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/remote/NotificationProducerClient.java Fri Dec 12 07:09:22 2008
@@ -99,6 +99,6 @@
         SubscribeResponse response = new SubscribeResponse(responseXML);
         EndpointReference epr = response.getSubscriptionReference();
         
-        return new SubscriptionClient(epr, getSource());
+        return new SubscriptionClient(epr, getSource(), getSoapClient());
     }
 }

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/topics/impl/SimpleTopic.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/topics/impl/SimpleTopic.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/topics/impl/SimpleTopic.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/topics/impl/SimpleTopic.java Fri Dec 12 07:09:22 2008
@@ -378,7 +378,7 @@
     
     public synchronized Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
     
     public synchronized Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/topics/impl/SimpleTopicNamespace.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/topics/impl/SimpleTopicNamespace.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/topics/impl/SimpleTopicNamespace.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/topics/impl/SimpleTopicNamespace.java Fri Dec 12 07:09:22 2008
@@ -184,7 +184,7 @@
     
     public synchronized Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
     
     public synchronized Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/topics/impl/SimpleTopicSet.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/topics/impl/SimpleTopicSet.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/topics/impl/SimpleTopicSet.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/topics/impl/SimpleTopicSet.java Fri Dec 12 07:09:22 2008
@@ -93,7 +93,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsrf-api/src/org/apache/muse/ws/resource/metadata/OpenMetadataDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf-api/src/org/apache/muse/ws/resource/metadata/OpenMetadataDescriptor.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf-api/src/org/apache/muse/ws/resource/metadata/OpenMetadataDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-wsrf-api/src/org/apache/muse/ws/resource/metadata/OpenMetadataDescriptor.java Fri Dec 12 07:09:22 2008
@@ -298,7 +298,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/lifetime/impl/SetTerminationTime.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/lifetime/impl/SetTerminationTime.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/lifetime/impl/SetTerminationTime.java (original)
+++ webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/lifetime/impl/SetTerminationTime.java Fri Dec 12 07:09:22 2008
@@ -118,7 +118,7 @@
     
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
     
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/lifetime/impl/SetTerminationTimeResponse.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/lifetime/impl/SetTerminationTimeResponse.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/lifetime/impl/SetTerminationTimeResponse.java (original)
+++ webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/lifetime/impl/SetTerminationTimeResponse.java Fri Dec 12 07:09:22 2008
@@ -111,7 +111,7 @@
     
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
     
     public Element toXML(Document doc)

Modified: webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/metadata/impl/PropertyMetadata.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/metadata/impl/PropertyMetadata.java?rev=726027&r1=726026&r2=726027&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/metadata/impl/PropertyMetadata.java (original)
+++ webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/metadata/impl/PropertyMetadata.java Fri Dec 12 07:09:22 2008
@@ -302,7 +302,7 @@
         else
         {
             QName qname = getPropertyName();
-            valueXML = XmlUtils.createElement(XmlUtils.EMPTY_DOC, qname, value);
+            valueXML = XmlUtils.createElement(XmlUtils.createDocument(), qname, value);
         }
         
         //
@@ -546,7 +546,7 @@
 
     public Element toXML()
     {
-        return toXML(XmlUtils.EMPTY_DOC);
+        return toXML(XmlUtils.createDocument());
     }
 
     public Element toXML(Document doc)