|
Boost : |
From: E. Gladyshev (egladysh_at_[hidden])
Date: 2003-08-17 20:45:04
I'd be interested in such library.
I think that boos::xml library should be using boost::spirit
for parsing XML streams.
Eugene
--- Wojtek Surowka <wojtek_surowka_at_[hidden]> wrote:
> 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
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk