Project

Profile

Help

Bug #3385

closed

Failure to handle CDATA nodes correctly

Added by Michael Kay over 6 years ago. Updated almost 4 years ago.

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

0%

Estimated time:
Applies to JS Branch:
Fix Committed on JS Branch:
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

DOM documents created by an XML parser (as distinct from documents created using XSLT) can contain CDATA nodes. There are many paths where we are failing to deal with these.

I came across one, in DomUtils.xmlToStringInner() we have a branch in the switch to handle CDATA nodes, but it wasn't applying escaping. (This caused a failure of one of the copy tests, unfortunately I failed to note which one). I've fixed this on the 2.0 branch.

A search for the constant TEXT_NODE reveals many cases where we handle text nodes without also handling CDATA nodes.

It may be worth doing a soak test of this by modifying the XML parser we use under Nashorn to generate CDATA nodes instead of text nodes.

Actions #1

Updated by Michael Kay over 6 years ago

Also, when we generate JS code to implement a node test for a text() node, it should match CDATA nodes as well as DOM text nodes.

Actions #2

Updated by Michael Kay over 6 years ago

Actually, we have code that normalizes an input tree by replacing all CDATA sections by ordinary text nodes. But the method (spaceStripper in transform.js) is called only if the stylesheet includes a strip-space declaration. It should be called unconditionally.

We may also need to think about documents that can reach us without going through this mechanism, e.g. documents returned from calls to Javascript functions.

Actions #3

Updated by Michael Kay almost 4 years ago

  • Description updated (diff)
  • Status changed from New to Closed

Closing this because it's three years old and we have no concrete evidence that there is actually a problem.

Please register to edit this issue

Also available in: Atom PDF Tracking page