Bug #4196
closedNavigation of wrapped DOM: merging of adjacent text nodes
100%
Description
Looking at the code for the DOMWrapper class, it's not clear that the code to merge adjacent text nodes is working on all paths. There's a lot of logic in ChildEnumeration to handle this, which will work for the child, following-sibling, and preceding-sibling axes; but the descendant axis relies on SteppingNavigator.DescendantAxisIterator, which in turn relies on DOMNodeWrapper implementing methods like nextSibling() and precedingSibling(), and as far as I can see these method do not consider the possibility of adjacent text nodes.
This examination of the code was prompted by a request on the saxon-help list for a mode of execution in which adjacent text nodes are treated as separate nodes. I'm not convinced the requirement for that is strong enough to justify the considerable effort that would be needed to test it thoroughly.
Updated by Michael Kay about 5 years ago
Added a JUnit test (DomTest.testAdjacentTextNodes....). This confirms that navigation of the descendant axis is failing to merge adjacent text nodes with a plain DOM wrapper, though it succeeds with a Domino tree.
Updated by Michael Kay about 5 years ago
- Status changed from New to Resolved
- Priority changed from Low to Normal
- Applies to branch 9.9, trunk added
- Fix Committed on Branch 9.9, trunk added
Fixed the getNextSibling(), getPreviousSibling(), and getFirstChild() methods in DOMNodeWrapper to account for adjacent text nodes in the DOM.
(At some time in the past, the descendant iterator for DOM trees was changed to be a SteppingIterator rather than to use the transitive closure of the child axis; this created a need for "stepping" methods such as getNextSibling(), which were written to (incorrectly) map directly onto the underlying methods on the DOM.)
Updated by O'Neil Delpratt almost 5 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.9.1.3 added
Bug fix applied to the Saxon 9.9.1.3 maintenance release
Please register to edit this issue