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 Boris Glawe <bo...@boris-glawe.de> on 2003/10/02 03:33:11 UTC
release question:
Hi,
do I have to release a string that is created like this:
DOMElement* element = doc->CreateElement(XMLString::transcode("anElement"));
I don't know, whether element saves the pointer that's returned by
transcode anywhere. Releasing does not make sense then, since the
(pointer to the) string is still needed.
And is the XMLString* released anywhere, when I say element->release()??
if not, how do I release the string then.
greets and thanks Boris
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: release question:
Posted by Gareth Reakes <ga...@decisionsoft.com>.
Hi,
also, if you look in the samples, you will find a macro that will
help you out. Its called X.
Gareth
On Thu, 2 Oct 2003, Alberto Massari wrote:
> At 03.45 02/10/2003 +0200, Boris Glawe wrote:
> >Boris Glawe wrote:
> >
> >>Hi,
> >>
> >>do I have to release a string that is created like this:
> >>
> >>DOMElement* element = doc->CreateElement(XMLString::transcode("anElement"));
> >>
> >>I don't know, whether element saves the pointer that's returned by
> >>transcode anywhere. Releasing does not make sense then, since the
> >>(pointer to the) string is still needed.
> >>And is the XMLString* released anywhere, when I say element->release()??
> >>if not, how do I release the string then.
>
> There are alternatives to using transcode; in this case, you are dealing
> with a constant, so you are could do it off-line.
> Examples:
>
> (on Visual C++)
> DOMElement* element = doc->CreateElement(L"anElement");
>
> (everywhere)
> static XMLCh anElementName[]={chLatin_a, chLatin_n, ....};
> DOMElement* element = doc->CreateElement(anElementName);
>
> Alberto
>
>
>
> ---------------------------------------------------------------------
> 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: release question:
Posted by Alberto Massari <am...@progress.com>.
At 03.45 02/10/2003 +0200, Boris Glawe wrote:
>Boris Glawe wrote:
>
>>Hi,
>>
>>do I have to release a string that is created like this:
>>
>>DOMElement* element = doc->CreateElement(XMLString::transcode("anElement"));
>>
>>I don't know, whether element saves the pointer that's returned by
>>transcode anywhere. Releasing does not make sense then, since the
>>(pointer to the) string is still needed.
>>And is the XMLString* released anywhere, when I say element->release()??
>>if not, how do I release the string then.
There are alternatives to using transcode; in this case, you are dealing
with a constant, so you are could do it off-line.
Examples:
(on Visual C++)
DOMElement* element = doc->CreateElement(L"anElement");
(everywhere)
static XMLCh anElementName[]={chLatin_a, chLatin_n, ....};
DOMElement* element = doc->CreateElement(anElementName);
Alberto
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: release question:
Posted by Boris Glawe <bo...@boris-glawe.de>.
Boris Glawe wrote:
> Hi,
>
> do I have to release a string that is created like this:
>
> DOMElement* element =
> doc->CreateElement(XMLString::transcode("anElement"));
>
> I don't know, whether element saves the pointer that's returned by
> transcode anywhere. Releasing does not make sense then, since the
> (pointer to the) string is still needed.
> And is the XMLString* released anywhere, when I say
> element->release()?? if not, how do I release the string then.
>
> greets and thanks Boris
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
>
I read the answer already in a posting from last June... According to
this posting my implementation is a bad thing, since my XMLString will
never be released.
puh xerces is really hard to handle from the technical point of view for
newbies.
This create and release stuff adds a lot code which is not semantically
connected with the program itself and makes it thus harder to read.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org