Hi,
        thats great if you want to test it. Take a look in 
tests/DOM/DOMTest/DTest.cpp. The spec says we have to return an XMLCh so
Eriks is closer.


> const XMLCh*     DOMNodeImpl::getTextContent() const
> {
>   DOMNode *thisNode = castToNode(this);
>   int nContentLength = 0;
>   { // Get total length of content
>     DOMNodeIteratorImpl nodeIterator(thisNode, 0x00000004, NULL, false);
> //
> SHOW_TEXT
>     DOMNode *currentNode = nodeIterator.nextNode();
>     while (currentNode) {
>       nContentLength +=
> XMLString::stringLen(currentNode->getNodeValue());
>       currentNode = nodeIterator.nextNode();
>     }
>   }
> 
>   // Allocate buffer
>   XMLCh* pzContentStr = new XMLCh[nContentLength+1];
>   *pzContentStr = 0;
> 
>   { // Fetch content
>     DOMNodeIteratorImpl nodeIterator(thisNode, 0x00000004, NULL, false);
> //
> SHOW_TEXT
>     DOMNode *currentNode = nodeIterator.nextNode();
>     while (currentNode) {
>       XMLString::catString(pzContentStr, currentNode->getNodeValue());
>       currentNode = nodeIterator.nextNode();
>     }
>   }
> 
>   return pzContentStr;

//to get arround the memory problem we can do
    XMLCh *stringCopy = 
((DOMDocumentImpl*)getOwnerDocument())->cloneString(pzContentStr);
    delete pzContentStr;
    return stringCopy;

//the user does not have to delete this memory

> }


give us a shout if you need any help.


Gareth

-- 
Gareth Reakes, Head of Product Development  +44-1865-203192
DecisionSoft Limited                        http://www.decisionsoft.com
XML Development and Services




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to