Re: [libxml++] Rename Element::add_content() to add_text_content?



On Thu, 2003-10-23 at 10:16, Murray Cumming Comneon com wrote:
> I think we should rename these xmlpp::Element methods like so:
> add_content() -> add_text_content() or maybe add_text().
> get_child_content() -> get_child_text_content() or maybe get_child_text()
> Set_child_content() -> set_child_text_content() or maybe set_child_text()
> http://libxmlplusplus.sourceforge.net/reference/html/classxmlpp_1_1Element.h
> tml
> because that is what they do.

I like add_text, set_text, and get_text without referring to child.
child is more or less implied. Lest you think someone confuse it with
the element name?

> And that makes more sense now that we have added add_comment().

Please add:
CommentNode* Document::add_comment(const std::string& content)
{
  xmlNode* node = xmlNewComment((xmlChar*)content.c_str());
  xmlAddChild( (xmlNode*) _impl, node);
  return static_cast<CommentNode*>(node->_private);
}

comments can be outside the root node too!

> I have also thought about removing the add_ methods() becauase the set_()
> methods do the same thing 90% of the time. The add_ methods are only useful
> if you want to add more than one text or comment node. I suppose that's
> slightly useful.

I think we should keep add_ in addition to set_ because a node can have
a child node list containing more than one text contents node. What if I
am able to implement my derived DOM such that in my derived SAX parser I
can add entity references to the DOM I am building? I then need to be
able to add_text(), add_entity_reference(), and add_text(), e.g. 







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]