Op 21-9-2006 11:44 heeft Daniel Veillard het volgende geschreven: > On Thu, Sep 21, 2006 at 11:18:04AM +0200, Kris Breuker wrote: > >>Hi, >> >>When I insert a document fragment node (XML_DOCUMENT_FRAG_NODE) into the >>XML tree (for example using xmlAddChild), the node itself gets inserted >>instead of its child nodes. This is a bit inconvenient because I am >>writing a DOM api for a scripting language we're developing here, and >>the specification >>(http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-B63ED1A3) states: >> >> >>>Furthermore, various operations -- such as inserting nodes as >>>children of another Node -- may take DocumentFragment objects as >>>arguments; this results in all the child nodes of the >>>DocumentFragment being moved to the child list of this node. > > > libxml2 don't pretend to implement DOM. XML_DOCUMENT_FRAG_NODE are > an invention of DOM, they don't mean anything from an XML core spec > point of view, best is to not generate them in the first place. > > >>I know I can use xmlAddChildList with the children property of the >>document fragment node, but there are no such functions for >>xmlAddPrevSibling (i.e. xmlAddPrevSiblingList). Is there an easy way of >>inserting the children of a document fragment instead of the document >>fragment itself? > > > If you know how to operate on a doubly linked list see -> next, -> prev > and on the parent node -> children and -> last. There is already a awful > lot of entry points in libxml2, I'm not sure I want to add more when in > general people are already just lost trying to find the existing entry > points. Either iterate on the list with the existing functions or do > direct access to list structures.
Ok, I will look into that then. Thanks, Kris _______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
