Boost logo

Boost :

From: Jake Voytko (jakevoytko_at_[hidden])
Date: 2007-07-11 23:58:51


On 7/11/07, David Abrahams <dave_at_[hidden]> wrote:
>
>
> on Wed Jul 11 2007, "Phil Endecott" <spam_from_boost_dev-AT-chezphil.org>
> wrote:
>
> > I think that using subclasses is the key to making this sort of
> > code easier on the eye:
> >
> > struct firstname: public element {
> > firstname(n): element("firstname",n) {};
> > };
> >
> > etc.
>
> You're already headed off in a harder-to-read direction from my point
> of view.

As well as a harder-to-implement direction. Having to make a struct for
every tag you implement seems a little user-unfriendly. For a constrained
format (like SVG) I could agree, but I think for Boost.XML library, there
should be easy naming.

Splitting the difference (or so I hope) between easy trees/expressiveness
and standard syntax, how about something like this?

root.push_front
(
  tag("Article Info",
     (title ? (comment("This title was moved"), title) : NULL)
     (tag("author",
          (tag("firstname", "Joe"))
          (tag("surname", "Random"))
      ))
  )
);


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