Project

Profile

Help

Support #5059

closed

NS default empty declaration added by transformer

Added by Youssouf MHOMA over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2021-08-10
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
10
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

Taking a document with a default namespace and sub-element in its scope without a specified namespace, the serialization of this document will conduct to the addition of an empty namespace inside the sub-elements with saxon > 10.X

Example, build of the document below

<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg"><title>a_title</title></svg>
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
Document dom = dbf.newDocumentBuilder().newDocument();

Element rootEle = dom.createElement("svg");
rootEle.setAttribute("xmlns", "http://www.w3.org/2000/svg");

Element titleEem = dom.createElement("title");
titleEem.setTextContent("a_title");
rootEle.appendChild(titleEem);

dom.appendChild(rootEle);

The serialization of this document with version => 10.X (10.2 and 10.5 tested) adds a default namespace empty for the title element, which is wrong,

<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg"><title xmlns="">a_title</title></svg>

This code is OK in version 9.9.1-5.


Files

SaxonTransformerExample.java (1.74 KB) SaxonTransformerExample.java Youssouf MHOMA, 2021-08-10 10:29
pom.xml (3.62 KB) pom.xml Youssouf MHOMA, 2021-08-10 10:29

Please register to edit this issue

Also available in: Atom PDF