Fix bug 57162: Content_types.xml and .rels files had elements with wrong namespace (the default one)

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1636188 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2014-11-02 20:53:02 +00:00
parent da85bfd23e
commit 80b148f56f
2 changed files with 4 additions and 4 deletions

View File

@ -444,7 +444,7 @@ public abstract class ContentTypeManager {
*/
private void appendSpecificTypes(Element root,
Entry<PackagePartName, String> entry) {
Element specificType = root.getOwnerDocument().createElement(OVERRIDE_TAG_NAME);
Element specificType = root.getOwnerDocument().createElementNS(TYPES_NAMESPACE_URI, OVERRIDE_TAG_NAME);
specificType.setAttribute(PART_NAME_ATTRIBUTE_NAME, entry.getKey().getName());
specificType.setAttribute(CONTENT_TYPE_ATTRIBUTE_NAME, entry.getValue());
root.appendChild(specificType);
@ -460,7 +460,7 @@ public abstract class ContentTypeManager {
* @see #save(java.io.OutputStream)
*/
private void appendDefaultType(Element root, Entry<String, String> entry) {
Element defaultType = root.getOwnerDocument().createElement(DEFAULT_TAG_NAME);
Element defaultType = root.getOwnerDocument().createElementNS(TYPES_NAMESPACE_URI, DEFAULT_TAG_NAME);
defaultType.setAttribute(EXTENSION_ATTRIBUTE_NAME, entry.getKey());
defaultType.setAttribute(CONTENT_TYPE_ATTRIBUTE_NAME, entry.getValue());
root.appendChild(defaultType);

View File

@ -36,8 +36,8 @@ import org.apache.poi.openxml4j.opc.TargetMode;
import org.apache.poi.openxml4j.opc.internal.PartMarshaller;
import org.apache.poi.openxml4j.opc.internal.ZipHelper;
import org.apache.poi.util.DocumentHelper;
import org.apache.poi.util.POILogger;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@ -134,7 +134,7 @@ public final class ZipPartMarshaller implements PartMarshaller {
for (PackageRelationship rel : rels) {
// the relationship element
Element relElem = xmlOutDoc.createElement(PackageRelationship.RELATIONSHIP_TAG_NAME);
Element relElem = xmlOutDoc.createElementNS(PackageNamespaces.RELATIONSHIPS, PackageRelationship.RELATIONSHIP_TAG_NAME);
root.appendChild(relElem);
// the relationship ID