Hi George. What's happening is that your query is returning org.jdom.CDATA objects rather than Strings. With recent versions of Jaxen+JDOM the query you are using will actually return org.jdom.Text objects rather than Strings so the query won't work without the <![CDATA[...]]> sections either. What you need to do is change your query to the following:
itemQuery="string(//ROW[@ID='0']/F_GCS_GROUP_OWNER_CODE/text())"; This will ensure that you are getting back String objects. Alternately you could change your loop to this: XPath xpath = new XPath(xmlQuery); List results = xpath.selectNodes( doc ); Iterator resultIter = results.iterator(); while ( resultIter.hasNext() { returnValue= ((org.jdom.CDATA) resultIter.next()).getText() } ; Cheers, David > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of George > Pieri > Sent: Wednesday, 27 February 2002 6:01 AM > To: Jaxen-Interest > Subject: [Jaxen] CDATA > > > > > I have problems retrieving data if it is enclosed in a CDATA section. > > I receive a....... > > main (11:21:58): java.lang.ClassCastException: org.jdom.CDATA > !?!? > > If I remove the CDATA wrapping around the text it works OK and I can > retrieve the value. > > Below is the query string I am using along with a snippet of the XML. > > > Any ideas !?! > > Thanks in advance! > > //------------------- > // Search string > //---------------------- > > itemQuery="//ROW[@ID='0']/F_GCS_GROUP_OWNER_CODE/text()"; > > //--------------------------------------------- > // Used to Retrieve the query String > //----------------------------------------------- > XPath xpath = new XPath(xmlQuery); > List results = xpath.selectNodes( doc ); > Iterator resultIter = results.iterator(); > while ( resultIter.hasNext() > { returnValue= (String) resultIter.next() } ; > > > //--------------------- > // XML being Searched > //---------------------- > > <USERS_SYSTEM_ACCESS> > <ROW ID="0" CHANGETYPE="N" > > <F_GCS_GROUP_OWNER_CODE><![CDATA[222]]></F_GCS_GROUP_OWNER_CODE> > </ROW> > <ROW ID="1" CHANGETYPE="N" > > <F_GCS_GROUP_OWNER_CODE><![CDATA[222]]></F_GCS_GROUP_OWNER_CODE> > </ROW> > </USER_SYSTEM_ACCESS> > > > _______________________________________________ > Jaxen-interest mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jaxen-interest _______________________________________________ Jaxen-interest mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jaxen-interest