Boost logo

Boost :

From: Stefan Seefeld (seefeld_at_[hidden])
Date: 2003-06-24 19:12:15


hi there,

some weeks ago I proposed an API for XML, which triggered an interesting
discussion. Hamish Mackenzie proposed a somewhat simpler mechanism to attach
the C++ wrapper objects to the C structs from libxml2.

I reworked the API to use that mechanism, so now using an xml document
looks somewhat like:

dom::document_ptr document("1.0");
dom::element_ptr root = document.create_root_node("root");
dom::element_ptr child = root.append_child("child");
dom::text_ptr text = root.append_text("hello world");
for (dom::element_ptr::child_iterator i = root.begin_children();
      i != root.end_children();
      ++i)
   std::cout << i->get_name() << std::endl;

As the wrapper objects have reference semantics, I append '_ptr' to
their name to stress that fact. A practical side-effect of this is
that the document is now ref-counted, as it doesn't own the node-wrappers
any more (as was the case in my former API).

Please review the package 'xml++-2003-06-24.tgz' at
http://groups.yahoo.com/group/boost/files/xml/

Kind regards,
                Stefan


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