XPath predicate issue reading CDATA with...

  • java54

    java54 - 2011-06-10

    While looking into switching to VTD-XML from Xerces, I've stumbled on a predicate issue involving ampersand and CDATA.  If I have the following XML:

    <?xml version="1.0" encoding="utf-8"?>
      <nodeA key="thisthat">
        <phrase><![CDATA[This & That]]></phrase>

    And I run this XPath:

    /test/nodeA[./phrase='This & That']/@key

    With Xerces, I get the key attribute value 'thisthat'.  With VTD-XML, I get an empty string.

    So far I haven't had any issues reading the CDATA directly, or referencing it in a predicate if there are no ampersands.  Also tried removing the CDATA and left the


    encoded (


    ).  Seemed to work fine for both Xerces and VTD-XML.

    However, when there's and ampersand in the CDATA, and it's referenced in an XPath predicate, VTD-XML doesn't seem to like it.  Thoughts?


  • jimmy zhang

    jimmy zhang - 2011-06-29

    sorry about late reply, will look into it and get back

  • jimmy zhang

    jimmy zhang - 2011-07-16

    this problem has been confirmed and fixed, you can check out from CVS or wait for next release


Log in to post a comment.