Boost logo

Boost :

From: Stefan Seefeld (seefeld_at_[hidden])
Date: 2005-11-08 11:13:26


thinking more about the involved issues, and especially taking into account
one comment regarding the need to pass 'internalized' strings around to avoid
duplicate conversions, I'm tempted by a radically different option:

Let the XML API provide a 'string_type' (or may be 'cdata_type'), and exclusively
operate on that. This type would be self-descriptive such that it could vary with
the backend, but always provide the same (compile-time) interface to users
(with tags for encoding, etc.).

Users then explicitely convert their strings back and forth on each call:

document_ptr doc(new document());
element_ptr root = doc->set_root(cdata_type("book"));

my_unicode_type name = ...;


Here, 'internalize' is a user-provided converter that generates dom::cdata_type
from my_unicode_type. Thus you can write as many converters as you have unicode
types, and have explicit control over when and where to convert. (Well, and if
you prefer implicit conversion, say, because you want to operate on a lot of
ASCII data, just add implicit cast and non-explicit constructors to your unicode

What about that ?


Boost list run by bdawes at, gregod at, cpdaniel at, john at