Re: AW: WG: AW: [xml] xmlwriter - the next step

On Thu, Oct 23, 2003 at 12:40:28PM +0200, Mickautsch, Alfred wrote:
-----Ursprüngliche Nachricht-----
Von: Daniel Veillard [mailto:veillard redhat com]
I think the next step for the xmlWriter, like for the xmlWalker will
be to add support to generate a tree or a subtree using this API.
Just too many people are confused by the basic tree operations.
Yes, you are right.
What do you think, would something like xmlNewTextWriterDoc for a
document tree and xmlNewTextWriterTree for a subtree do or should
there be just one function, which checks the node type and sets the
behavior automagically? Besides: is there any difference at all or
am I just inventing one? :-)

  I would separate both APIs

  xmlNewTextWriterDoc() would return a new xmlDocPtr

  xmlNewTextWriterTree() would take a doc and an existing node within that
doc, and add any new elements as last child of the given node. It should IMHO
return the first element added that way. The only danger is to be careful
about text node coalescing done by libxml2 if adding text sibling to existing
text nodes.


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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