Boost logo

Boost :

From: Jake Voytko (jakevoytko_at_[hidden])
Date: 2007-07-12 11:22:12


On 7/12/07, Oliver.Kowalke_at_[hidden] <Oliver.Kowalke_at_[hidden]> wrote:

> I would do it over templates - than it's type safe and a part of the xml
> validation can be done at compile time.
>
> typedef tag<
> mpl::vector< title, author > // tags
> mpl::vector< isbn > // atributes
> > article_info;

I hadn't considered compile-time type safety when I wrote my above example.
However, I feel an example like this might also preclude XML features like
comments. If we were to parse an existing article:

  <article_info isbn="foo">
      <!--Article information goes here-->
      <title>bar</title>
      <author>Testy McTest</author>
  </article_info>

your definition doesn't immediately make it clear that the comment, when
parsed, ends up in the document tree. I may, however, just be missing
something. Complicating matters, according to the standard, they can also
appear within the document type declaration, so comments significantly
complicate the matter:
http://www.w3.org/TR/REC-xml/#sec-prolog-dtd

And the standard also lists retrieval of comment text as optional:
http://www.w3.org/TR/REC-xml/#sec-comments

But I think that a Boost.XML library should support the retrieval of the
text of comments.

Jake


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