[XML-SIG] xpath (4xpath) and CDATA

Fred L. Drake, Jr. fdrake@acm.org
Tue, 3 Apr 2001 10:46:21 -0400 (EDT)


Rich Salz writes:
 > xpath (which Martin has merged in from 4Xpath) doesn't recognize CDATA
 > nodes.  According to the spec, http://www.w3.org/TR/xpath#NT-NodeType ,
 > "a CDATA section is treated as if the <![CDATA[ and ]]> were removed and
 > every occurrence of < and & were replaced by &lt; and &amp; respectively."
 > 
 > I think the way to fix this is to add CDATA_SECTION_NODE next to every
 > place that TEXT_NODE appears, but to do the above conversion whenever the
 > *value* of the node is needed.

  It's not at all clear what conversion is needed.  Do you propose
converting it to a text node and replacing the '<' and '&' characters
with EntityReference nodes?  It sounds to me like the XPath spec is
referring to the serialization format, which is just confusing when
talking about nodes.
  I think adding the CDATA_SECTION_NODE to the nodeType check is
sufficient.  So don't let me stop you!  ;-)


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Digital Creations