Boost logo

Boost Users :

Subject: Re: [Boost-users] [spirit] qi xml parser
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2014-07-07 19:09:03


On 8/07/2014 01:38, Michael Powell wrote:
> It's an interesting question, thank you for the insight. I get what
> you mean, and yes, it is all about trade offs, between utility of the
> domain model and developing a grammar that will help, and not hinder,
> the domain model. The interesting questions are to do with how and
> when to allow children (i.e. likely not in a comment node). It could
> be that generally everything can be modeled as a tree, i.e. xobject
> children of xobject parent, with appropriate specializations and/or
> treatment of references, pointers, iterators, etc. Then the trade off
> is trusting that the end user is responsible with his/her usage of
> domain model.

Yes, that's the idea, you just have a single tree of objects, but each
one is specialised with its particular quirks. (Have a look at the XML
DOM definitions.)

If you use actual inheritance, you could have the base class provide the
common functionality (tracking parents and children, with add/remove
methods) but have them influenced by protected abstract policy methods
implemented by the specific type classes, eg. such that a comment node
can refuse to have children added to it.

Also, while I haven't looked at it myself, I recently recall seeing this
post, which you might want to investigate further:
   http://lists.boost.org/boost-users/2014/05/82093.php


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net