Boost logo

Boost :

From: Alan Gutierrez (alan-boost_at_[hidden])
Date: 2005-11-01 23:13:44


* Reece Dunn <msclrhd_at_[hidden]> [2005-11-01 13:17]:
> Cromwell Enage wrote:
> >--- Stefan Seefeld wrote:
> > > This is simply to see whether there is still any
> > > interest into such an API, and to get some
> >discussion
> > > on the design.
> >
> >Count me in as an interested party.
>
> And me :).
>
> One thing that I would like to see is the use of [] for performing XPath
> queries, e.g.:
>
> xmldom << L"<xml-data>...</xml-data>"; // set xml
>
> std::cout << "found " << xmldom[ L"xml-data/foo/@bar" ];
>
> With current technologies like Lambda and Spirit, we can make a streamlined
> XML API that fits in with C++ paradigms.

    This is nice syntax for both parsing and xquery.

    I'd suggest syntax that returns an axis as well.

    axis decendent_or_self = xmldom[ L"/xml/foo" ].decendent_or_self;
    for (i = decendent_or_self.begin(); i != decendent_or_self.end(); i++)
    {
        node n = *i;
        if (n.namespace_uri() != null)
        {
            std::cout << n.namespace_uri() << "\n";
        }
    }

    Excuse my C++. I'm rusty.

--
Alan Gutierrez - alan_at_[hidden] - http://engrm.com/blogometer/

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