tags:

views:

439

answers:

1

example...

<xml>
<level1>
<level2>
<![CDATA[ Release Date: 11/20/09 <br />View Trailer ]]>
</level2>
</level1>
</xml>

when I use inFeed.getXpath().evaluate("xml/level1/level2", myNodeList);

I get "Release Date:11/20/09 View Trailer"

I was under the impression that the whole point of CDATA is that it preserves whatever mumbo jumbo you care to throw in there. Am I using the wrong xpath expression? or am just approaching this all wrong?

+2  A: 

Not sure what I'm doing differently from you but for me

public class XpathFun
{
    public static void main(String[] args) throws Exception
    {
     String xml = "<xml><level1><level2><![CDATA[ Release Date: 11/20/09 <br />View Trailer ]]></level2></level1></xml>";
     InputSource inputSource = new InputSource(new ByteArrayInputStream(xml.getBytes()));
     System.out.println(XPathFactory.newInstance().newXPath().evaluate("xml/level1/level2", inputSource));
    }
}

results in:

Release Date: 11/20/09 <br />View Trailer
Instantsoup
I was doing something totally stupid... nm, thanks very much for the help
Dr.Dredel