Index: src/main/java/info/magnolia/importexport/DataTransporter.java
===================================================================
--- src/main/java/info/magnolia/importexport/DataTransporter.java	(revision 30035)
+++ src/main/java/info/magnolia/importexport/DataTransporter.java	(working copy)
@@ -37,6 +37,7 @@
 import info.magnolia.cms.core.Content;
 import info.magnolia.cms.core.HierarchyManager;
 import info.magnolia.cms.core.ItemType;
+import info.magnolia.cms.core.SystemProperty;
 import info.magnolia.cms.util.ContentUtil;
 import info.magnolia.cms.util.NodeDataUtil;
 import info.magnolia.context.MgnlContext;
@@ -501,7 +502,8 @@
         outputFormat.setIndent(INDENT_VALUE);
         outputFormat.setLineWidth(120); // need to be set after setIndenting()!
 
-        MetadataUuidFilter metadataUuidFilter = new MetadataUuidFilter(reader); // MAGNOLIA-1650
+        MetadataUuidFilter metadataUuidFilter = new MetadataUuidFilter(reader, !SystemProperty
+            .getBooleanProperty("magnolia.export.keep_extra_namespaces")); // MAGNOLIA-1650
         metadataUuidFilter.setContentHandler(new XMLSerializer(outputStream, outputFormat));
         metadataUuidFilter.parse(new InputSource(inputStream));
 
Index: src/main/java/info/magnolia/importexport/filters/MetadataUuidFilter.java
===================================================================
--- src/main/java/info/magnolia/importexport/filters/MetadataUuidFilter.java	(revision 30035)
+++ src/main/java/info/magnolia/importexport/filters/MetadataUuidFilter.java	(working copy)
@@ -33,6 +33,7 @@
  */
 package info.magnolia.importexport.filters;
 
+import org.apache.commons.lang.ArrayUtils;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
@@ -41,7 +42,8 @@
 
 /**
  * A simple filter that strips jcr:uuid properties in MetaData nodes. Needed due to MAGNOLIA-1650 uuids in MetaData
- * nodes are changed during import.
+ * nodes are changed during import. It also supports removal of non-standards namespaces, by setting the
+ * <code>removeUnwantedNamespaces</code> flag in the constructor.
  * @author fgiust
  * @version $Revision: $ ($Author: $)
  */
@@ -54,17 +56,57 @@
 
     private boolean skipProperty;
 
+    private boolean inSkippedNs;
+
+    private String[] validNs = new String[]{"jcr", "rep", "xsi", "xs", "fn_old", "mgnl", "nt", "fn", "sv"};
+
+    private boolean removeUnwantedNamespaces;
+
     /**
      * Instantiates a new MetadataUuidFilter filter.
      * @param parent wrapped XMLReader
+     * @deprecated
      */
     public MetadataUuidFilter(XMLReader parent) {
         super(parent);
     }
 
     /**
+     * Instantiates a new MetadataUuidFilter filter.
+     * @param parent wrapped XMLReader
+     * @param removeUnwantedNamespaces if set, non standard jcr namespaces will be removed
+     */
+    public MetadataUuidFilter(XMLReader parent, boolean removeUnwantedNamespaces) {
+        super(parent);
+        this.removeUnwantedNamespaces = removeUnwantedNamespaces;
+    }
+
+    /**
      * {@inheritDoc}
      */
+    public void endPrefixMapping(String prefix) throws SAXException {
+        if (!inSkippedNs) {
+            super.endPrefixMapping(prefix);
+        }
+        inSkippedNs = false;
+
+    }
+
+    /**
+     * Skip unwanted namespaces, see MAGNOLIA-2756
+     */
+    public void startPrefixMapping(String prefix, String uri) throws SAXException {
+        if (!removeUnwantedNamespaces || ArrayUtils.contains(validNs, prefix)) {
+            super.startPrefixMapping(prefix, uri);
+        }
+        else {
+            inSkippedNs = true;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public void endElement(String uri, String localName, String qName) throws SAXException {
 
         if (inMetadataElement > 0) {
Index: src/test/java/info/magnolia/importexport/DataTransporterTest.java
===================================================================
--- src/test/java/info/magnolia/importexport/DataTransporterTest.java	(revision 30035)
+++ src/test/java/info/magnolia/importexport/DataTransporterTest.java	(working copy)
@@ -33,7 +33,9 @@
  */
 package info.magnolia.importexport;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
 import org.custommonkey.xmlunit.DetailedDiff;
 import org.custommonkey.xmlunit.Diff;
 import org.custommonkey.xmlunit.Difference;
@@ -64,7 +66,8 @@
 
     /**
      * Test method for
-     * {@link info.magnolia.importexport.DataTransporter#readFormatted(org.xml.sax.XMLReader, java.io.File, java.io.OutputStream)}.
+     * {@link info.magnolia.importexport.DataTransporter#readFormatted(org.xml.sax.XMLReader, java.io.File, java.io.OutputStream)}
+     * .
      */
     public void testParseAndFormat() throws Exception {
 
@@ -100,4 +103,28 @@
         assertTrue("Document is not formatted as expected", xmlDiff.identical());
     }
 
+    /**
+     * Test method for
+     * {@link info.magnolia.importexport.DataTransporter#readFormatted(org.xml.sax.XMLReader, java.io.File, java.io.OutputStream)}
+     * .
+     */
+    public void testRemoveNs() throws Exception {
+
+        File inputFile = new File(getClass().getResource("/test-unwantedns.xml").getFile());
+        File outputFile = File.createTempFile("export-test-", ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
+        OutputStream outputStream = new FileOutputStream(outputFile);
+
+        XMLReader reader = XMLReaderFactory.createXMLReader(org.apache.xerces.parsers.SAXParser.class.getName());
+
+        DataTransporter.readFormatted(reader, inputFile, outputStream);
+
+        IOUtils.closeQuietly(outputStream);
+
+        String result = FileUtils.readFileToString(outputFile);
+        outputFile.delete();
+
+        assertFalse("'removeme' namespace still found in output file", StringUtils.contains(result, "xmlns:removeme"));
+        assertTrue("'jcr' namespace not found in output file", StringUtils.contains(result, "xmlns:jcr"));
+
+    }
 }
Index: src/test/resources/test-unwantedns.xml
===================================================================
--- src/test/resources/test-unwantedns.xml	(revision 0)
+++ src/test/resources/test-unwantedns.xml	(revision 0)
@@ -0,0 +1,11 @@
+<!-- don't reformat this document! the wrong formatting is needed for tests -->
+<sv:node sv:name="help" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:mgnl="http://www.magnolia.info/jcr/mgnl"
+  xmlns:rep="internal" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fn="http://www.w3.org/2005/xpath-functions"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:removeme="http://none"
+  xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions" xmlns:jcrfn="http://www.jcp.org/jcr/xpath-functions/1.0">
+  <sv:property sv:name="jcr:isCheckedOut" sv:type="Boolean">
+    <sv:value>true</sv:value>
+  </sv:property>
+</sv:node>
+

Property changes on: src/test/resources/test-unwantedns.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

