SAX/C++: C++-specific design principles
Daniel.Veillard at w3.org
Fri Dec 3 13:15:28 GMT 1999
On Thu, Dec 02, 1999 at 04:32:36PM -0500, David Megginson wrote:
> Here are the principles that I applied to creating my first draft
> SAX/C++ interface:
I'm afraid I won't be able to provide this interface in libxml
(the Gnome XML library http://xmlsoft.org/) due to the focus on C++,
though a C++ wrapper on top should be able to provide it.
> 2. Pointers never change ownership -- if a Parser (for example) wants
> to own an InputSource, it needs to make its own copy. The app has
> to free everything that it allocates, and the SAX driver, likewise.
Very good idea,
> 4. Hold my nose and use UTF-8 rather than UTF-16, for compatibility
> with most existing C++ code.
Like James pointed out it's hard to segregate a class of users.
UTF-8 compacteness will be appreciated by people wanting low memory
overhead when building transaction processing. UTF-16 will simplify
interfacing to DOM or using XML in UI oriented apps.
> 5. Use char * rather than string, to avoid forcing a lot of allocation
> overhead on the SAX driver.
I did opt for the simple approach having an xmlChar type used everywhere
except non XML content (filenames, errors messages ...). Having it 8 or
16 bits should be a compile-time (or run-time but that's more risky)
Daniel.Veillard at w3.org | W3C, INRIA Rhone-Alpes | Today's Bookmarks :
Tel : +33 476 615 257 | 655, avenue de l'Europe | Linux XML libxml WWW
Fax : +33 476 615 207 | 38330 Montbonnot FRANCE | Gnome rpm2html rpmfind
http://www.w3.org/People/all#veillard%40w3.org | RPM badminton Kaffe
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev