Bug #4937
closedExtra NS declaration added by transformer
100%
Description
<a xmlns='someNS' name='test'><b xmlns=''/></a>
is transformed into
<a xmlns='someNS' name='test'><b xmlns='' xmlns=''/></a>
which is not valid
org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 24; Attribute "xmlns" was already specified for element "b".
see test case attached. That works fine with 9.9 (HE, EE)
java -cp saxon9he.jar;. testSaxonTransformer
but fails with 10.0-10.3 (HE, EE) also tried with EE 10.4
java -cp saxon-he-10.3.jar;. testSaxonTransformer
but the transformed is correct when I add another NS. Like:
<a xmlns='someNS' xmlns:z='z' name='test'><b xmlns=''/></a>
Files
Updated by Michael Kay almost 4 years ago
- Category set to DOM Interface
- Status changed from New to In Progress
- Assignee set to Michael Kay
- Priority changed from Low to Normal
- Applies to branch trunk added
Thanks for reporting it.
Reproduced as JUnit test testNamespaceSerializationBug4937().
Updated by Michael Kay almost 4 years ago
The error appears to be when combining two namespace maps (NamespaceMap.applyDifferences()
-- which is not actually DOM-specific code, though it's probably used rather differently when handling DOM input.). This ends up incorrectly generating an empty namespace map for element b, rather than a map containing the single namespace binding (""=""). This error is then compounded: because the namespace map is empty, the scan of attributes on element b doesn't check whether any of the attributes are actually namespaces, so it's processing xmlns:"" a second time as if it were an ordinary attribute.
Updated by Michael Kay almost 4 years ago
I've applied a fix to NamespaceMap.applyDifferences()
on the 10.x branch which ensures this test now passes. However, the test passes on the 11.x branch without this change: I'm currently exploring why.
Updated by Michael Kay almost 4 years ago
- Status changed from In Progress to Resolved
- Fix Committed on Branch 10, trunk added
It was working on the 11.x branch because my configuration settings meant I was picking up Xalan as the DOM identityTransformer. Fixed this, found the bug was still present, so I've applied the patch to both branches.
Updated by O'Neil Delpratt over 3 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 10.5 added
Bug fix applied to Saxon 10.5 maintenance release.
Please register to edit this issue