I think that what is still missing in Boost is a library for reading and
writing XML files. I have such a library, though in rather preliminary
state (encodings support is missing, and also not all of XML constructs are
supported). Anyway, I have used it in some projects for e.g. reading and
writing configuration files. For reading, it uses an iterator, a little bit
similar to istream_iterator. For writing, it uses interface similar to
standard streams. Here you have a code presenting the interface of the
library:

void traverse(
��� const xml::read_iterator& begin,
��� const xml::read_iterator& end,
��� const std::string& spaces)
{
��� for (xml::read_iterator it = begin; it != end; ++it)
��� {
������� if (it->type() == xml::element)
������� {
����������� std::cout << spaces << it->str() << "\n";
����������� traverse(it->begin(),it->end(),spaces+" ");
������� }
��� }
} 

int main()
{
��� // test read_iterator, the output is: 
��� // root
��� //� a
��� std::istringstream iss("<root><a atr='value'> b </a></root>");
��� traverse(xml::read_iterator(iss),xml::read_iterator(),"");

��� // test ostream, the output is: 
��� // <a>
��� //� <b ee='f'/>
��� // </a>
��� xml::ostream xos(std::cout);
��� xos << xml::tag("a") << xml::down <<
������� xml::tag("b") << xml::attr("ee","f") <<
������� xml::up;
} 

If there will be an interest, I can submit the library code and extend it. 
Regards,
Wojtek Sur�wka 

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to