Hi Eirk,
a quick search of bugzilla returns no results for me regarding
getTextContent. Could you check to ensure we have got a patch in?
cheers,
Gareth
On Mon, 14 Jul 2003, Erik Rydgren wrote:
> Well yes and no. The getTextContent method is distributed with version
> 2.3. But it contains a bug. I hope that a committer has put the patch
> into the nightly build by now.
>
> If you are compiling Xerces yourself then it is a breeze to extend your
> 2.2 version to support getTextContent. Just put the following code in
> DOMNodeImpl.h.
>
> const XMLCh* getTextContent(XMLCh* pzBuffer, unsigned int&
> rnBufferLength) const;
> const XMLCh* getTextContent() const ;
>
>
> And the following in DOMNodeImpl.cpp.
>
> const XMLCh* DOMNodeImpl::getTextContent(XMLCh* pzBuffer, unsigned int&
> rnBufferLength) const
> {
> unsigned int nRemainingBuffer = rnBufferLength;
> rnBufferLength = 0;
> if (pzBuffer)
> *pzBuffer = 0;
>
> DOMNode *thisNode = castToNode(this);
> switch (thisNode->getNodeType()) {
> case DOMNode::ELEMENT_NODE:
> case DOMNode::ENTITY_NODE:
> case DOMNode::ENTITY_REFERENCE_NODE:
> case DOMNode::DOCUMENT_FRAGMENT_NODE:
> {
> DOMNode* current = thisNode->getFirstChild();
> while (current != NULL) {
> if (current->getNodeType() != DOMNode::COMMENT_NODE &&
> current->getNodeType() !=
> DOMNode::PROCESSING_INSTRUCTION_NODE)
> {
> if (pzBuffer) {
> unsigned int nContentLength = nRemainingBuffer;
> castToNodeImpl(current)->getTextContent(pzBuffer +
> rnBufferLength, nContentLength);
> rnBufferLength += nContentLength;
> nRemainingBuffer -= nContentLength;
> }
> else {
> unsigned int nContentLength = 0;
> castToNodeImpl(current)->getTextContent(NULL,
> nContentLength);
> rnBufferLength += nContentLength;
> }
> }
> current = current->getNextSibling();
> }
> }
> break;
>
> case DOMNode::ATTRIBUTE_NODE:
> case DOMNode::TEXT_NODE:
> case DOMNode::CDATA_SECTION_NODE:
> case DOMNode::COMMENT_NODE:
> case DOMNode::PROCESSING_INSTRUCTION_NODE:
> {
> const XMLCh* pzValue = thisNode->getNodeValue();
> unsigned int nStrLen = XMLString::stringLen(pzValue);
> if (pzBuffer) {
> unsigned int nContentLength = (nRemainingBuffer >= nStrLen) ?
> nStrLen : nRemainingBuffer;
> XMLString::copyNString(pzBuffer + rnBufferLength, pzValue,
> nContentLength);
> rnBufferLength += nContentLength;
> nRemainingBuffer -= nContentLength;
> }
> else {
> rnBufferLength += nStrLen;
> }
> }
> break;
> }
> return pzBuffer;
> }
>
>
> const XMLCh* DOMNodeImpl::getTextContent() const
> {
> unsigned int nStringLength = 0;
> getTextContent(NULL, nStringLength);
> XMLCh* pzBuffer = (XMLCh*)
> ((DOMDocumentImpl*)getOwnerDocument())->allocate((nStringLength+1) *
> sizeof(XMLCh));
> getTextContent(pzBuffer, nStringLength);
> pzBuffer[nStringLength] = 0;
> return pzBuffer;
> }
>
> Regards
> Erik Rydgren
> Mandarin IT
> Sweden
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > Sent: den 11 juli 2003 21:54
> > To: [EMAIL PROTECTED]
> > Subject: getTextContent()
> >
> >
> > Do I have to upgrade to 2.3 to be able to use getTextContent()? I am
> > currently using 2.2 and am a little apprehensive about
> upgrading....but I
> > will if I have to.
> >
> > Thanks.
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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]
>
>
>
--
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]