I guess it is time for some exploration and profiling and maybe a few
alternative approaches.
The point about UTF-8 and UTF-16 strings definitely suggest that allowing
different string implementations for internal vs external use might be
valuable. In extreme cases (like the OT stuff), then gzip'ing the text
nodes could be worthwhile. In most big documents, you would assume that you
have a substantial amount of redundancy in the tag and attribute names, so
the best compression would be through sharing references to the same chunk
of text (which I think the current DOMString already does). You could also
minimize whitespace by using a couple of bytes to encode the number of
leading and trailing spaces and linefeeds. I don't think that you could
support that all through just a plain XMLCh*, however whatever the internal
string class should be as lightweight as possible.
You would also probably want to allow the user to supply an allocator so
they could tune the types of optimizations performed and avoid using the
global new and delete's with their synchronization overhead. The allocator
interface could have distinct methods for allocating tag names, attribute
names, attribute values and character data (since different optimizations
would be appropriate for each).
I tried to emphasize basic_string semantics, for instance, .append() instead
of appendData() and not being in danger of changing the document if you
manipulated a string you got back from getTagname() without doing a clone()
first. Whether or not basic_string's implementation was appropriate was
definitely a question that I was leaving open.
Since this appears to be something people are willing to consider, I'll take
some time to flesh this out.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]