Re: [xml] xmlNodeSetContent that doesn't wipe out child elements?

Date view Thread view Subject view Author view

From: TOM (ptittom@free.fr)
Date: Sat Oct 21 2000 - 17:32:20 EDT


On 21/10/2000 22:58:33 Harry Blundell wrote:
> My reading of xmlNodeSetContent is that it wipes out
> node->content, and all of node's child nodes, and then acts
> differently to save the new content depending on whether the node
> is a comment (in which case it uses node->content) or an element
> (in which case it creates child nodes to hold the new content.
>
> This doesn't work so well for elements that have mixed content
> (both text content, and child elements). Is there a function that
> replaces the content of an element, while leaving its child
> elements alone, or do I have to write one?

Mixed content doesn't use node->content but text nodes between element
nodes.
Imagine you have node->content not NULL *AND* child elements. When you
need to "serialize" the tree, where do you put node->content in relation
with child elements ? before ? after ? somewhere between ? There's no
issue!

If you have child elements, text content is represented by text nodes
(XML_TEXT_NODE) between your child elements (XML_ELEMENT_NODES).
You can figure out this passing the --debug option to xmllint.

HTH

----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Oct 21 2000 - 17:43:22 EDT