|
Boost : |
From: John Moeller (fishcorn_at_[hidden])
Date: 2007-07-12 03:38:20
David Abrahams wrote:
> Okay, this is going to sound very opinionated:
>
> I find XML horrible to read, however I find most of the procedural
> code I've seen for manipulating it even more horrible.
Agreed. Much of the time, I find myself defining wrapper RAII classes
to handle the tags.
> [snip]
>
> root.push_front(
> tag("articleinfo")[
> title ? (comment("This title was moved"), title) : NULL
> , tag("author")[
> tag("firstname")["Joe"],
> tag("surname")["Random"]
> ]
> ]
> )
I like this syntax; it was a little awkward for me at first, but it's
grown on me.
Would this allow you to also save a "template" for later modification?
Something like:
tag articleinfo = tag("articleinfo") [
tag("author") [
tag("firstname") [""],
tag("surname") [""]
]
];
...
articleinfo["author"]["firstname"] = "Joe";
articleinfo["author"]["surname"] = "Random";
I would find this use case to be handy.
-- John Moeller fishcorn_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk