What version of the parser do you use? The getTextContent method wasn't implemented up to the 2.3.0 version. Using the current implementation I have no problems reading the text content of an element containing CDATASections.
/ Erik > -----Original Message----- > From: Thomas Zabel [mailto:[EMAIL PROTECTED] > Sent: den 2 december 2003 14:34 > To: [EMAIL PROTECTED] > Subject: How to get the nodevalue/textcontent of a cdatasection? ? ? > > Hallo, > sorry, that I post this here in the developers-forum, but who can help me, > if not you........and I could't find any hints in the > mailing-lists.............. > I parse follwing xml-document: > > <?xml version="1.0" encoding="iso-8859-1" standalone="no"?> > <AUTHORING> > <ARTICLE ID="868888"> > <META> > <ARTICLETYP ID="0"/> > <NEWSTYP ID="1">Aktien</NEWSTYP> > <CATEGORY ID="5">Marktberichte</CATEGORY> > <AUTHOR ID="341">SmartHouseMedia </AUTHOR> > <TIMESTAMP>1068023820</TIMESTAMP> > <MSEG ID=""/><BRANCH ID=""/><LAND ID=""/> > <COPYRIGHT>&copy; wallstreet:online AG / SmartHouse Media > GmbH</COPYRIGHT> > <PRIMARYSTOCK ISIN="" WKN="" SYMBOL="" WOID="" > INDEX_NAME_LIST=""></PRIMARYSTOCK> > </META> > <CONTENT> > <HEADLINE><![CDATA[TecDAX am Morgen: Rote Vorzeichen, LION > verliert > �ber 8 Prozent]]></HEADLINE> > <SUBLINE><![CDATA[Die deutschen Nebenwerte im TecDAX sind mit > leichten Abschl�gen in den Mittwoch-Handel gestartet. Der > TecDAX]]></SUBLINE> > </CONTENT> > </ARTICLE> > </AUTHORING> > > what I want is the content/nodevalue of the CDATAsection in the element > 'SUBLINE'. to do that, i have written follwing simple programme, but it > doesn't to, what i want. > > domparser=new XercesDOMParser(); > domparser->parse("wallstreet.xml"); > DOMDocument *parsedxmldoc=domparser->getDocument(); > DOMNodeList *referenced = parsedxmldoc- > >getElementsByTagName(X("SUBLINE")); > cout << "count of nodes:" << referenced->getLength(); > cout << "content:" << > XMLString::transcode(referenced->item(0)->getTextContent()); > cout << "\nNodename:" << > XMLString::transcode(referenced->item(0)->getNodeName()); > cout << "\ncontent:" << > XMLString::transcode(referenced->item(0)->getFirstChild()- > >getNodeValue()); > //cout << "\ncontent:" << > XMLString::transcode(referenced->item(0)->getFirstChild()->getData()); > cout << "\ncontent:" << > XMLString::transcode(referenced->item(0)->getFirstChild()- > >getTextContent()); > cout << "\nname of child:" << > XMLString::transcode(referenced->item(0)->getFirstChild()->getNodeName() ); > if (referenced->item(0)->getFirstChild()->getNodeValue()) cout << > "nodevalue!=NULL!\n"; > > this is the output, that i get: > --------------------- > count of nodes:1 > content: > Nodename:SUBLINE > content: > content: > name of child:#cdata-section > nodevalue!=NULL! > > Whats wrong? is it possible, that there is a bug? > I 'd be very lucky, if anybodey could give me a hint, how to get the > textcontent/nodevalue of a CDADASection-node, because this is very > important for my > project > > Thanx in advance > Thomas > > > > > > > > > > I would be very thankful, if anybody of you could tell me, what I do > wrong. to me it seems as if I haven't done something wrong. if somebody > could tell > me, that I haven't done anything wrong, I'd be very appreciated, too. then > I > could make a bug-report............ > > > > > > > > > -- > +++ GMX - die erste Adresse f�r Mail, Message, More +++ > Neu: Preissenkung f�r MMS und FreeMMS! http://www.gmx.net > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
