Hi Dale,

EXT-Pennington, Dale K <[EMAIL PROTECTED]> writes:

> The second approach to dynamically allocate and reallocate an array of
> XMLCh's as I go. That will handle arbitarily sized strings, but will
> also mean a lot more heap action. (not to mention a certain amount of
> copying depending on the realloc method used).

You can also pre-calculate the size of the resulting string by
iterating over the child nodes twice: the first time to calculate
the size and the second time to copy the text. Iterating over
child nodes is quite cheap (that is, if you don't use DOMNodeList)
and in your situation there probably won't be more than a handful
of child nodes.

Boris

-- 
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open-Source, Cross-Platform C++ XML Data Binding

Reply via email to