Boost logo

Boost :

From: Daniel James (daniel_james_at_[hidden])
Date: 2006-09-10 03:07:45


Stefan Seefeld:
> Could you detail a bit what you mean by 'DOM' and 'DOM-like' here ? We all are probably thinking of
> some tree structure that can be navigated, queried, etc..
>

Jon Radoff wrote:
> However, some have already argued that the DOM API as it exists for Java is inappropriate for C++,
> or even that the DOM API is already conceptually broken.
>
>
The XML DOM has a standardized API:

http://www.w3.org/DOM/DOMTR

It's designed to be implemented across different languages and mentions
C++ in some places. But I don't think this is what you're after.

> A good C++ implementation, in my mind, would attempt to utilize a Document class hierarchy, perhaps based directly upon the object hierarchy presented in the Java Document interface. In C++ we can enhance it by using familiar STL containers for a lot of things. For example, Java provides a getElementsByTagName API (gets me a list of all the elements given a particular name). In C++ it would be nice if the equivalent function gave me a hash_multimap<string,Element> so I could work whatever iteration magic I felt like.
>
A hash_multimap (or unordered_multimap) would be inappropriate. The DOM
standard requires that getElementsByTagName returns a NodeList, which is
live - ie. it updates dynamically when the XML document is updated.

http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core.html#ID-536297177

If you're implementing a different interface, then be careful with
unordered_multimap, it isn't guaranteed to maintain the order of the
elements and in XML documents the order is important. If the
implementation you're using does maintain the order, you might find that
your code isn't portable.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk