From: Renato Forti

I need convert DOMNode* into std::string! How I can do this,

For a DOMNode containing #PCDATA, off the top of my head, something like:

std::wstring  xmlContainedString( const DOMNode *pNode )
{
   std::wstring sResult;
   if( !pNode ) return sResult;    // Error => empty string.

   DOMNode *pText = pNode->getFirstChild();

   if( pText &&  (pText->getNodeType() == DOMNode::TEXT_NODE) )
sResult = pText->getNodeValue();
   return sResult;
}

And BTW  I recommend always using wide strings (std::wstring)

Dave

David Webber
Mozart Music Software
http://www.mozart.co.uk/

Reply via email to