From: Stefan Seefeld (seefeld_at_[hidden])
Date: 2007-07-09 21:11:29
Jake Voytko wrote:
> I'm looking through the example code and I have a few questions.
> - Is it possible to have parameters in the tags? For example:
> element_ptr g_elem = root->insert_element("g");
> g_elem->add_parameter("stroke_color", "red");
> <g stroke_color = "red">
> Is this what append_element() does, or is there another function to do this?
What you call a 'parameter' is actually called an 'attribute', and it gets
(it can't be "added" since it may only exist once. Thus, you can set and unset it.)
> - The operator->() syntax.. It would appear that you did this because all of
> the elements act as pointers. However, I feel that some of the operations
> are unclear as to why they should be implemented using the -> syntax
> my_elem -> write_to_file("my_file.xml"), for example.
'write_to_file' is a method of 'document', not 'element'. The reason why
I expect applications to hold document pointers is that they often get
instantiated by a parser (acting as a factory).
> - Also, how far does the pointer analogy carry? If I call
> does this go to the next child of my_elem->parent()?
No. an element doesn't have iterator semantics.
> I second the call for documentation from Mathias. This nonwithstanding, good
> work so far!
Thanks ! And yes, I will do my best to write some documentation (beside
some API reference that can be readily extracted via synopsis or doxygen).
Thanks for the feedback,
-- ...ich hab' noch einen Koffer in Berlin...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk