Index: /usr/src/jackrabbit/trunk/jackrabbit-webdav/pom.xml
===================================================================
--- /usr/src/jackrabbit/trunk/jackrabbit-webdav/pom.xml	(revision 601631)
+++ /usr/src/jackrabbit/trunk/jackrabbit-webdav/pom.xml	(working copy)
@@ -70,8 +70,9 @@
       <artifactId>commons-collections</artifactId>
     </dependency>
     <dependency>
-      <groupId>xerces</groupId>
-      <artifactId>xercesImpl</artifactId>
+      <groupId>xpp3</groupId>
+      <artifactId>xpp3</artifactId>
+      <version>1.1.4c</version>
     </dependency>
     <dependency>
       <groupId>javax.servlet</groupId>
Index: /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/client/methods/XmlRequestEntity.java
===================================================================
--- /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/client/methods/XmlRequestEntity.java	(revision 601631)
+++ /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/client/methods/XmlRequestEntity.java	(working copy)
@@ -16,18 +16,17 @@
  */
 package org.apache.jackrabbit.webdav.client.methods;
 
+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.jackrabbit.webdav.xml.XPP3DomSerializer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-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.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();
+        XPP3DomSerializer.serialize(xmlDocument, out);
         delegatee = new StringRequestEntity(out.toString(), "text/xml", "UTF-8");
     }
 
Index: /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java
===================================================================
--- /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java	(revision 601631)
+++ /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java	(working copy)
@@ -16,6 +16,29 @@
  */
 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;
@@ -21,8 +44,8 @@
 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: /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavResponseImpl.java
===================================================================
--- /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavResponseImpl.java	(revision 601631)
+++ /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavResponseImpl.java	(working copy)
@@ -16,19 +16,28 @@
  */
 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.XPP3DomSerializer;
+import org.apache.jackrabbit.webdav.xml.DomUtil;
 import org.apache.jackrabbit.webdav.xml.XmlSerializable;
-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.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
@@ -33,16 +42,6 @@
 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();
+                XPP3DomSerializer.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: /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/DomUtil.java
===================================================================
--- /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/DomUtil.java	(revision 601631)
+++ /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/DomUtil.java	(working copy)
@@ -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 XPP3DocumentBuilderFactory();
     static {
         BUILDER_FACTORY.setNamespaceAware(true);
         BUILDER_FACTORY.setIgnoringComments(true);
Index: /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/XPP3DocumentBuilder.java
===================================================================
--- /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/XPP3DocumentBuilder.java	(revision 0)
+++ /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/XPP3DocumentBuilder.java	(revision 0)
@@ -0,0 +1,103 @@
+/*
+ * 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;
+import org.xmlpull.v1.dom2_builder.DOM2XmlPullBuilder;
+
+public class XPP3DocumentBuilder extends DocumentBuilder {
+
+    private DocumentBuilder jaxpBuilder;
+
+    private DOM2XmlPullBuilder builder;
+
+    XPP3DocumentBuilder(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: /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/XPP3DocumentBuilderFactory.java
===================================================================
--- /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/XPP3DocumentBuilderFactory.java	(revision 0)
+++ /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/XPP3DocumentBuilderFactory.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 XPP3DocumentBuilderFactory 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 XPP3DocumentBuilder(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: /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/XPP3DomSerializer.java
===================================================================
--- /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/XPP3DomSerializer.java	(revision 0)
+++ /usr/src/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/XPP3DomSerializer.java	(revision 0)
@@ -0,0 +1,112 @@
+/*
+ * 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.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.mxp1_serializer.MXSerializer;
+
+public class XPP3DomSerializer {
+
+    public static final String ENCODING = "UTF-8";
+
+    private final MXSerializer serializer;
+
+    private XPP3DomSerializer() {
+        serializer = new MXSerializer();
+    }
+
+    private XPP3DomSerializer(OutputStream stream) throws IOException {
+        this();
+        serializer.setOutput(stream, ENCODING);
+    }
+
+    private XPP3DomSerializer(Writer writer) {
+        this();
+        serializer.setOutput(writer);
+    }
+
+    public static void serialize(Document document, OutputStream stream)
+            throws IOException {
+        XPP3DomSerializer serializer = new XPP3DomSerializer(stream);
+        serializer.printDocument(document);
+    }
+
+    public static void serialize(Document document, Writer writer)
+            throws IOException {
+        XPP3DomSerializer serializer = new XPP3DomSerializer(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());
+    }
+
+}

