Index: src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java
===================================================================
--- src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java	(Revision 603182)
+++ src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java	(Arbeitskopie)
@@ -16,13 +16,36 @@
  */
 package org.apache.jackrabbit.webdav;
 
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.ParserConfigurationException;
+
 import org.apache.jackrabbit.webdav.header.CodedUrlHeader;
 import org.apache.jackrabbit.webdav.header.DepthHeader;
 import org.apache.jackrabbit.webdav.header.IfHeader;
 import org.apache.jackrabbit.webdav.header.LabelHeader;
 import org.apache.jackrabbit.webdav.header.OverwriteHeader;
+import org.apache.jackrabbit.webdav.header.PollTimeoutHeader;
 import org.apache.jackrabbit.webdav.header.TimeoutHeader;
-import org.apache.jackrabbit.webdav.header.PollTimeoutHeader;
 import org.apache.jackrabbit.webdav.lock.LockInfo;
 import org.apache.jackrabbit.webdav.lock.Scope;
 import org.apache.jackrabbit.webdav.lock.Type;
@@ -49,30 +72,9 @@
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletInputStream;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.BufferedInputStream;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.security.Principal;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  * <code>WebdavRequestImpl</code>...
  */
@@ -264,7 +266,9 @@
                 bin.reset();
                 if (!isEmpty) {
                     DocumentBuilder docBuilder = DomUtil.BUILDER_FACTORY.newDocumentBuilder();
-                    requestDocument = docBuilder.parse(bin);
+                    InputSource src = new InputSource(bin);
+                    src.setEncoding(httpRequest.getCharacterEncoding());
+                    requestDocument = docBuilder.parse(src);
                 }
             }
         } catch (IOException e) {
Index: src/main/java/org/apache/jackrabbit/webdav/WebdavResponseImpl.java
===================================================================
--- src/main/java/org/apache/jackrabbit/webdav/WebdavResponseImpl.java	(Revision 603182)
+++ src/main/java/org/apache/jackrabbit/webdav/WebdavResponseImpl.java	(Arbeitskopie)
@@ -16,33 +16,32 @@
  */
 package org.apache.jackrabbit.webdav;
 
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Locale;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.jackrabbit.webdav.header.CodedUrlHeader;
+import org.apache.jackrabbit.webdav.header.Header;
 import org.apache.jackrabbit.webdav.lock.ActiveLock;
 import org.apache.jackrabbit.webdav.lock.LockDiscovery;
 import org.apache.jackrabbit.webdav.observation.EventDiscovery;
+import org.apache.jackrabbit.webdav.observation.ObservationConstants;
 import org.apache.jackrabbit.webdav.observation.Subscription;
 import org.apache.jackrabbit.webdav.observation.SubscriptionDiscovery;
-import org.apache.jackrabbit.webdav.observation.ObservationConstants;
 import org.apache.jackrabbit.webdav.property.DavPropertySet;
-import org.apache.jackrabbit.webdav.xml.XmlSerializable;
+import org.apache.jackrabbit.webdav.xml.XmlPullDomSerializer;
 import org.apache.jackrabbit.webdav.xml.DomUtil;
-import org.apache.jackrabbit.webdav.header.CodedUrlHeader;
-import org.apache.jackrabbit.webdav.header.Header;
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
+import org.apache.jackrabbit.webdav.xml.XmlSerializable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.parsers.ParserConfigurationException;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Locale;
-
 /**
  * WebdavResponseImpl implements the <code>WebdavResponse</code> interface.
  */
@@ -147,17 +146,14 @@
     public void sendXmlResponse(XmlSerializable serializable, int status) throws IOException {
         httpResponse.setStatus(status);
         if (serializable != null) {
-            ByteArrayOutputStream out = new ByteArrayOutputStream();
+            StringWriter out = new StringWriter();
             try {
                 Document doc = DomUtil.BUILDER_FACTORY.newDocumentBuilder().newDocument();
                 doc.appendChild(serializable.toXml(doc));
-                
-                OutputFormat format = new OutputFormat("xml", "UTF-8", false);
-                XMLSerializer serializer = new XMLSerializer(out, format);
-                serializer.setNamespaces(true);
-                serializer.asDOMSerializer().serialize(doc);
 
-                byte[] bytes = out.toByteArray();
+                XmlPullDomSerializer.serialize(doc, out);
+
+                byte[] bytes = out.toString().getBytes("UTF-8");
                 httpResponse.setContentType("text/xml; charset=UTF-8");
                 httpResponse.setContentLength(bytes.length);
                 httpResponse.getOutputStream().write(bytes);
Index: src/main/java/org/apache/jackrabbit/webdav/xml/XmlPullDocumentBuilder.java
===================================================================
--- src/main/java/org/apache/jackrabbit/webdav/xml/XmlPullDocumentBuilder.java	(Revision 0)
+++ src/main/java/org/apache/jackrabbit/webdav/xml/XmlPullDocumentBuilder.java	(Revision 0)
@@ -0,0 +1,102 @@
+/*
+ * 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.jackrabbit.webdav.xml;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+import javax.xml.parsers.DocumentBuilder;
+
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xmlpull.v1.XmlPullParserException;
+
+public class XmlPullDocumentBuilder extends DocumentBuilder {
+
+    private DocumentBuilder jaxpBuilder;
+
+    private DOM2XmlPullBuilder builder;
+
+    XmlPullDocumentBuilder(DocumentBuilder factory) {
+        this.jaxpBuilder = factory;
+        this.builder = new DOM2XmlPullBuilder();
+    }
+
+    public DOMImplementation getDOMImplementation() {
+        return jaxpBuilder.getDOMImplementation();
+    }
+
+    public boolean isNamespaceAware() {
+        return true;
+    }
+
+    public boolean isValidating() {
+        return false;
+    }
+
+    public Document newDocument() {
+        return jaxpBuilder.newDocument();
+    }
+
+    public Document parse(InputSource is) throws SAXException, IOException {
+        Reader reader;
+        if (is.getCharacterStream() != null) {
+            reader = is.getCharacterStream();
+        } else if (is.getByteStream() != null) {
+            String enc = (is.getEncoding() == null)
+                    ? "UTF-8"
+                    : is.getEncoding();
+            reader = new InputStreamReader(is.getByteStream(), enc);
+            reader = new BufferedReader(reader);
+        } else {
+            reader = null;
+        }
+
+        if (reader != null) {
+            Document doc = newDocument();
+            try {
+                Element root = builder.parse(reader, doc);
+                doc.appendChild(root);
+            } catch (XmlPullParserException xppe) {
+                throw new SAXException(xppe.getMessage(), xppe);
+            }
+            return doc;
+        }
+
+        throw new IOException("Cannot read InputSource " + is);
+    }
+
+    public void setEntityResolver(EntityResolver er) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setErrorHandler(ErrorHandler eh) {
+        // TODO Auto-generated method stub
+
+    }
+
+}
Index: src/main/java/org/apache/jackrabbit/webdav/xml/DOM2XmlPullBuilder.java
===================================================================
--- src/main/java/org/apache/jackrabbit/webdav/xml/DOM2XmlPullBuilder.java	(Revision 0)
+++ src/main/java/org/apache/jackrabbit/webdav/xml/DOM2XmlPullBuilder.java	(Revision 0)
@@ -0,0 +1,232 @@
+package org.apache.jackrabbit.webdav.xml;
+
+/* -*-             c-basic-offset: 4; indent-tabs-mode: nil; -*-  //------100-columns-wide------>|*/
+//for license please see accompanying LICENSE.txt file (available also at http://www.xmlpull.org/)
+
+import java.io.IOException;
+import java.io.Reader;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Text;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.XmlPullParserFactory;
+import org.w3c.dom.DOMException;
+
+//TOOD add parse methodthat will usenextToken() to reconstruct complete XML infoset
+
+/**
+* <strong>Simplistic</strong> DOM2 builder that should be enough to do support most cases.
+* Requires JAXP DOMBuilder to provide DOM2 implementation.
+* <p>NOTE:this class is stateless factory and it is safe to share between multiple threads.
+* </p>
+*
+* @author <a href="http://www.extreme.indiana.edu/~aslom/">Aleksander Slominski</a>
+*/
+
+public class DOM2XmlPullBuilder {
+
+ //protected XmlPullParser pp;
+ //protected XmlPullParserFactory factory;
+
+ public DOM2XmlPullBuilder() { //throws XmlPullParserException {
+     //factory = XmlPullParserFactory.newInstance();
+ }
+ //public DOM2XmlPullBuilder(XmlPullParser pp) throws XmlPullParserException {
+ //public DOM2XmlPullBuilder(XmlPullParserFactory factory)throws XmlPullParserException
+ //{
+ //    this.factory = factory;
+ //}
+
+ protected Document newDoc() throws XmlPullParserException {
+     try {
+         // if you see dreaded "java.lang.NoClassDefFoundError: org/w3c/dom/ranges/DocumentRange"
+         // add the newest xercesImpl and apis JAR file to JRE/lib/endorsed
+         // for more deatils see: http://java.sun.com/j2se/1.4.2/docs/guide/standards/index.html
+         DocumentBuilderFactory domFactory
+             = DocumentBuilderFactory.newInstance();
+         DocumentBuilder builder = domFactory.newDocumentBuilder();
+         DOMImplementation impl = builder.getDOMImplementation();
+         return builder.newDocument();
+     } catch (FactoryConfigurationError ex) {
+         throw new XmlPullParserException(
+             "could not configure factory JAXP DocumentBuilderFactory: "+ex, null, ex);
+     } catch (ParserConfigurationException ex) {
+         throw new XmlPullParserException(
+             "could not configure parser JAXP DocumentBuilderFactory: "+ex, null, ex);
+     }
+ }
+
+ protected XmlPullParser newParser() throws XmlPullParserException {
+     XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
+     return factory.newPullParser();
+ }
+
+ public Element parse(Reader reader) throws XmlPullParserException, IOException {
+     Document docFactory = newDoc();
+     return parse(reader, docFactory);
+ }
+
+ public Element parse(Reader reader, Document docFactory)
+     throws XmlPullParserException, IOException
+ {
+     XmlPullParser pp = newParser();
+     pp.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
+     pp.setInput(reader);
+     pp.next();
+     return parse(pp, docFactory);
+ }
+
+ public Element parse(XmlPullParser pp, Document docFactory)
+     throws XmlPullParserException, IOException
+ {
+     Element root = parseSubTree(pp, docFactory);
+     return root;
+ }
+
+ public Element parseSubTree(XmlPullParser pp) throws XmlPullParserException, IOException {
+     Document doc = newDoc();
+     Element root = parseSubTree(pp, doc);
+     return root;
+ }
+
+ public Element parseSubTree(XmlPullParser pp, Document docFactory)
+     throws XmlPullParserException, IOException
+ {
+     BuildProcess process = new BuildProcess();
+     return process.parseSubTree(pp, docFactory);
+ }
+
+ static class BuildProcess {
+     private XmlPullParser pp;
+     private Document docFactory;
+     private boolean scanNamespaces = true;
+
+     private BuildProcess() {
+     }
+
+     public Element parseSubTree(XmlPullParser pp, Document docFactory)
+         throws XmlPullParserException, IOException
+     {
+         this.pp = pp;
+         this.docFactory = docFactory;
+         return parseSubTree();
+     }
+
+     private Element parseSubTree()
+         throws XmlPullParserException, IOException
+     {
+         pp.require( XmlPullParser.START_TAG, null, null);
+         String name = pp.getName();
+         String ns = pp.getNamespace(    );
+         String prefix = pp.getPrefix();
+         String qname = prefix != null ? prefix+":"+name : name;
+         Element parent = docFactory.createElementNS(ns, qname);
+
+         //declare namespaces - quite painful and easy to fail process in DOM2
+         declareNamespaces(pp, parent);
+
+         // process attributes
+         for (int i = 0; i < pp.getAttributeCount(); i++)
+         {
+             String attrNs = pp.getAttributeNamespace(i);
+             String attrName = pp.getAttributeName(i);
+             String attrValue = pp.getAttributeValue(i);
+             if(attrNs == null || attrNs.length() == 0) {
+                 parent.setAttribute(attrName, attrValue);
+             } else {
+                 String attrPrefix = pp.getAttributePrefix(i);
+                 String attrQname = attrPrefix != null ? attrPrefix+":"+attrName : attrName;
+                 parent.setAttributeNS(attrNs, attrQname, attrValue);
+             }
+         }
+
+         // process children
+         while( pp.next() != XmlPullParser.END_TAG ) {
+             if (pp.getEventType() == XmlPullParser.START_TAG) {
+                 Element el = parseSubTree(pp, docFactory);
+                 parent.appendChild(el);
+             } else if (pp.getEventType() == XmlPullParser.TEXT) {
+                 String text = pp.getText();
+                 Text textEl = docFactory.createTextNode(text);
+                 parent.appendChild(textEl);
+             } else {
+                 throw new XmlPullParserException(
+                     "unexpected event "+XmlPullParser.TYPES[ pp.getEventType() ], pp, null);
+             }
+         }
+         pp.require( XmlPullParser.END_TAG, ns, name);
+         return parent;
+     }
+
+     private void declareNamespaces(XmlPullParser pp, Element parent)
+         throws DOMException, XmlPullParserException
+     {
+         if(scanNamespaces) {
+             scanNamespaces = false;
+             int top = pp.getNamespaceCount(pp.getDepth()) - 1;
+             // this loop computes list of all in-scope prefixes
+             LOOP:
+             for (int i = top; i >= pp.getNamespaceCount(0); --i)
+             {
+                 // make sure that no prefix is duplicated
+                 String prefix = pp.getNamespacePrefix(i);
+                 for (int j = top; j > i; --j)
+                 {
+                     String prefixJ = pp.getNamespacePrefix(j);
+                     if((prefix != null && prefix.equals(prefixJ))
+                            || (prefix != null && prefix == prefixJ) )
+                     {
+                         // prefix is already declared -- skip it
+                         continue LOOP;
+                     }
+                 }
+                 declareOneNamespace(pp, i, parent);
+             }
+         } else {
+             for (int i = pp.getNamespaceCount(pp.getDepth()-1);
+                      i < pp.getNamespaceCount(pp.getDepth());
+                  ++i)
+             {
+                 declareOneNamespace(pp, i, parent);
+             }
+         }
+     }
+
+     private void declareOneNamespace(XmlPullParser pp, int i, Element parent)
+         throws DOMException, XmlPullParserException {
+         String xmlnsPrefix = pp.getNamespacePrefix(i);
+         String xmlnsUri = pp.getNamespaceUri(i);
+         String xmlnsDecl = (xmlnsPrefix != null) ? "xmlns:"+xmlnsPrefix : "xmlns";
+         parent.setAttributeNS("http://www.w3.org/2000/xmlns/", xmlnsDecl, xmlnsUri);
+     }
+
+
+ }
+
+ private static void assertEquals(String expected, String s) {
+     if((expected != null && !expected.equals(s)) || (expected == null && s == null)) {
+         throw new RuntimeException("expected '"+expected+"' but got '"+s+"'");
+     }
+ }
+ private static void assertNotNull(Object o) {
+     if(o == null) {
+         throw new RuntimeException("expected no null value");
+     }
+ }
+
+ /**
+  * Minimal inline test
+  */
+ public static void main(String[] args) throws Exception {
+
+ }
+
+}
+
+
Index: src/main/java/org/apache/jackrabbit/webdav/xml/XmlPullDomSerializer.java
===================================================================
--- src/main/java/org/apache/jackrabbit/webdav/xml/XmlPullDomSerializer.java	(Revision 0)
+++ src/main/java/org/apache/jackrabbit/webdav/xml/XmlPullDomSerializer.java	(Revision 0)
@@ -0,0 +1,113 @@
+/*
+ * 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.jackrabbit.webdav.xml;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+
+import org.kxml2.io.KXmlSerializer;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.xmlpull.v1.XmlSerializer;
+
+public class XmlPullDomSerializer {
+
+    public static final String ENCODING = "UTF-8";
+
+    private final XmlSerializer serializer;
+
+    private XmlPullDomSerializer() {
+        serializer = new KXmlSerializer();
+    }
+
+    private XmlPullDomSerializer(OutputStream stream) throws IOException {
+        this();
+        serializer.setOutput(stream, ENCODING);
+    }
+
+    private XmlPullDomSerializer(Writer writer) throws IOException {
+        this();
+        serializer.setOutput(writer);
+    }
+
+    public static void serialize(Document document, OutputStream stream)
+            throws IOException {
+        XmlPullDomSerializer serializer = new XmlPullDomSerializer(stream);
+        serializer.printDocument(document);
+    }
+
+    public static void serialize(Document document, Writer writer)
+            throws IOException {
+        XmlPullDomSerializer serializer = new XmlPullDomSerializer(writer);
+        serializer.printDocument(document);
+    }
+
+    private void printDocument(Document document) throws IOException {
+        serializer.startDocument(ENCODING, Boolean.TRUE);
+
+        DocumentType docType = document.getDoctype();
+        if (docType != null) {
+            serializer.docdecl(docType.getName() + " PUBLIC "
+                + docType.getPublicId());
+        }
+
+        printElement(document.getDocumentElement());
+
+        serializer.endDocument();
+    }
+
+    private void printElement(Element element) throws IOException {
+
+        serializer.startTag(element.getNamespaceURI(), element.getLocalName());
+
+        NamedNodeMap attrs = element.getAttributes();
+        if (attrs != null) {
+            for (int i = 0, l = attrs.getLength(); i < l; i++) {
+                Attr attr = (Attr) attrs.item(i);
+                serializer.attribute(attr.getNamespaceURI(),
+                    attr.getLocalName(), attr.getValue());
+            }
+        }
+
+        for (Node node = element.getFirstChild(); node != null; node = node.getNextSibling()) {
+            switch (node.getNodeType()) {
+                case Node.CDATA_SECTION_NODE:
+                    serializer.cdsect(node.getNodeValue());
+                    break;
+                case Node.COMMENT_NODE:
+                    serializer.comment(node.getNodeValue());
+                    break;
+                case Node.TEXT_NODE:
+                    serializer.text(node.getNodeValue());
+                    break;
+                case Node.ELEMENT_NODE:
+                    printElement((Element) node);
+                    break;
+            }
+        }
+
+        serializer.endTag(element.getNamespaceURI(), element.getLocalName());
+    }
+
+}
Index: src/main/java/org/apache/jackrabbit/webdav/xml/XmlPullDocumentBuilderFactory.java
===================================================================
--- src/main/java/org/apache/jackrabbit/webdav/xml/XmlPullDocumentBuilderFactory.java	(Revision 0)
+++ src/main/java/org/apache/jackrabbit/webdav/xml/XmlPullDocumentBuilderFactory.java	(Revision 0)
@@ -0,0 +1,73 @@
+/*
+ * 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.jackrabbit.webdav.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+public class XmlPullDocumentBuilderFactory extends DocumentBuilderFactory {
+
+    private static final DocumentBuilderFactory BUILDER_FACTORY = DocumentBuilderFactory.newInstance();
+
+    private static DocumentBuilder BUILDER;
+
+    static {
+        BUILDER_FACTORY.setNamespaceAware(true);
+        BUILDER_FACTORY.setIgnoringComments(true);
+        BUILDER_FACTORY.setIgnoringElementContentWhitespace(true);
+        BUILDER_FACTORY.setCoalescing(true);
+        BUILDER_FACTORY.setValidating(false);
+    }
+
+    private Map attributes = new HashMap();
+
+    public Object getAttribute(String name) throws IllegalArgumentException {
+        return attributes.get(name);
+    }
+
+    public DocumentBuilder newDocumentBuilder()
+            throws ParserConfigurationException {
+        return new XmlPullDocumentBuilder(getJaxpBuilder());
+    }
+
+    public void setAttribute(String name, Object value)
+            throws IllegalArgumentException {
+        attributes.put(name, value);
+    }
+
+    public boolean getFeature(String name) {
+        return false;
+    }
+
+    public void setFeature(String name, boolean value) {
+    }
+
+    private static DocumentBuilder getJaxpBuilder()
+            throws ParserConfigurationException {
+        if (BUILDER == null) {
+            BUILDER = BUILDER_FACTORY.newDocumentBuilder();
+        }
+        return BUILDER;
+    }
+
+}
Index: src/main/java/org/apache/jackrabbit/webdav/xml/DomUtil.java
===================================================================
--- src/main/java/org/apache/jackrabbit/webdav/xml/DomUtil.java	(Revision 603182)
+++ src/main/java/org/apache/jackrabbit/webdav/xml/DomUtil.java	(Arbeitskopie)
@@ -43,7 +43,7 @@
      * Constant for <code>DocumentBuilderFactory</code> which is used
      * widely to create new <code>Document</code>s
      */
-    public static DocumentBuilderFactory BUILDER_FACTORY = DocumentBuilderFactory.newInstance();
+    public static DocumentBuilderFactory BUILDER_FACTORY = new XmlPullDocumentBuilderFactory();
     static {
         BUILDER_FACTORY.setNamespaceAware(true);
         BUILDER_FACTORY.setIgnoringComments(true);
Index: src/main/java/org/apache/jackrabbit/webdav/client/methods/XmlRequestEntity.java
===================================================================
--- src/main/java/org/apache/jackrabbit/webdav/client/methods/XmlRequestEntity.java	(Revision 603182)
+++ src/main/java/org/apache/jackrabbit/webdav/client/methods/XmlRequestEntity.java	(Arbeitskopie)
@@ -16,18 +16,17 @@
  */
 package org.apache.jackrabbit.webdav.client.methods;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.StringWriter;
+
 import org.apache.commons.httpclient.methods.RequestEntity;
 import org.apache.commons.httpclient.methods.StringRequestEntity;
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
+import org.apache.jackrabbit.webdav.xml.XmlPullDomSerializer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 
-import java.io.OutputStream;
-import java.io.IOException;
-import java.io.ByteArrayOutputStream;
-
 /**
  * <code>XmlRequestEntity</code>...
  */
@@ -39,11 +38,8 @@
 
     public XmlRequestEntity(Document xmlDocument) throws IOException {
         super();
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
-        OutputFormat format = new OutputFormat("xml", "UTF-8", false);
-        XMLSerializer serializer = new XMLSerializer(out, format);
-        serializer.setNamespaces(true);
-        serializer.asDOMSerializer().serialize(xmlDocument);
+        StringWriter out = new StringWriter();
+        XmlPullDomSerializer.serialize(xmlDocument, out);
         delegatee = new StringRequestEntity(out.toString(), "text/xml", "UTF-8");
     }
 
Index: pom.xml
===================================================================
--- pom.xml	(Revision 603182)
+++ pom.xml	(Arbeitskopie)
@@ -70,8 +70,9 @@
       <artifactId>commons-collections</artifactId>
     </dependency>
     <dependency>
-      <groupId>xerces</groupId>
-      <artifactId>xercesImpl</artifactId>
+      <groupId>net.sf.kxml</groupId>
+      <artifactId>kxml2</artifactId>
+      <version>2.2.2</version>
     </dependency>
     <dependency>
       <groupId>javax.servlet</groupId>
