You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Thomas Zabel <th...@gmx.net> on 2003/12/01 13:27:36 UTC

getnodevalue() seems not to work properly

Hello,

I'am  a xalan-c-newbie. perhaps someone here can help me or has occured the
same problem.....I didn`t find anything solving my problem in the
mailingslists....
I give you a code-example......
first I give you the XML-source of the node, that has to be evaluated......


       <HEADLINE><![CDATA[TecDAX am Morgen: Rote Vorzeichen, LION verliert
über 8 Prozent]]></HEADLINE>


now comes the C++-Source-Code:
-----------------------------------------

       // first I evaluate an XPath-expression. the wrapper contains a
XercesDOMDocument   
       XalanNode *context=theWrapper.getDocumentElement();
       XalanNode *result=theEvaluator.selectSingleNode(theDOMSupport,
                                                   context,
                                                  
XalanDOMString(xpathtonode).c_str());

       // now I have a XercesNode
       DOMNode* xerNode= (DOMNode*)(theWrapper.mapNode(result));
        

        // and now i want to print the text-content of the CDATA-section
       if(result->getFirstChild()->getNodeType() ==
DOMNode::CDATA_SECTION_NODE)
       {
           cout << "CDATA_SECTION_NODE\n";
           cout <<  "content:" <<
XMLString::transcode(result->getFirstChild()->getNodeValue();
       }
   
the output  of this programme is like this:
--------------------------------


        CDATA_SECTION_NODE
        content:       (<-------- NOTHING!!!!!!!     WHY???? )


you see, I can't get the content of the CData-section withe getNodeValue. I
tried everything: getTextContent(), I casted to a CharacterDataNode and
tried
.getData(), nothing helped. it is , as if the CDATA-section contains
nothing.....

if I serialize the same node with a DOMWriter to a   StdOutFormatTarget the
CDATA-node  is printed.
but I need the only the content.........
it seems to me, as I do nothing wrong, am I right? what could be the reason
????????? is it due to the mapping from xalan? what are alternative ways, if
this way to get the content doesnt'work?
Please help me!!!!!

Many Thanx in advance and regards
Thomas


















-- 
Neu bei GMX: Preissenkung für MMS-Versand und FreeMMS!

Ideal für alle, die gerne MMS verschicken:
25 FreeMMS/Monat mit GMX TopMail.
http://www.gmx.net/de/cgi/produktemail

+++ GMX - die erste Adresse für Mail, Message, More! +++