Using docx4j 2.6.0 namespaces on our attributes were being thrown away for custom xml parts by the FlatOpcXmlImporter. It uses XmlUtils to copy the custom xml data element into a new org.w3c.dom.Document. I'm not sure what this class is intended to do, but the DOM API directly supports this functionality and doesn't ditch the namespaces. I recommend the following patch. It fixes our problem.
Index: FlatOpcXmlImporter.java
===================================================================
--- FlatOpcXmlImporter.java (revision 1343)
+++ FlatOpcXmlImporter.java (working copy)
@@ -522,8 +522,8 @@
javax.xml.parsers.DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
org.w3c.dom.Document doc = dbf.newDocumentBuilder().newDocument();
- XmlUtils.treeCopy(el, doc);
-
+ org.w3c.dom.Node copy = doc.importNode(el, true);
+ doc.appendChild(copy);
data.setDocument(doc);
((org.docx4j.openpackaging.parts.CustomXmlDataStoragePart) part)