xerces-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Zabel" <thomas.za...@gmx.net>
Subject How to get the nodevalue/textcontent of a cdatasection? ? ?
Date Tue, 02 Dec 2003 13:33:46 GMT
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>&amp;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: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Mime
View raw message