You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by el...@ni.com on 2003/07/11 21:53:45 UTC
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: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: getTextContent()
Posted by PeiYong Zhang <pe...@ca.ibm.com>.
Hi, there,
If I remember correctly, the said getTextContent() was added after 2.2
and before 2.3, that is saying you may have it from one of the nightly
builds
in between, but not in 2.2.
Rgds,
PeiYong
----- Original Message -----
From: <el...@ni.com>
To: <xe...@xml.apache.org>
Sent: Friday, July 11, 2003 3:53 PM
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: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
RE: getTextContent()
Posted by Gareth Reakes <ga...@decisionsoft.com>.
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: elliot.rapp@ni.com [mailto:elliot.rapp@ni.com]
> > Sent: den 11 juli 2003 21:54
> > To: xerces-c-dev@xml.apache.org
> > 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: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
>
--
Gareth Reakes, Head of Product Development +44-1865-203192
DecisionSoft Limited http://www.decisionsoft.com
XML Development and Services
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
RE: getTextContent()
Posted by Erik Rydgren <er...@mandarinen.se>.
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: elliot.rapp@ni.com [mailto:elliot.rapp@ni.com]
> Sent: den 11 juli 2003 21:54
> To: xerces-c-dev@xml.apache.org
> 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: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org