Re: [xml] manipulating tree causes Seg fault
- From: Michael Ludwig <mlu as-guides com>
- To: xml gnome org
- Subject: Re: [xml] manipulating tree causes Seg fault
- Date: Wed, 12 Aug 2009 19:50:56 +0200
Nick Lang schrieb:
Find a specific text node. Replace with an element node (containing a
let's leave out all the regex stuff; it does not seem relevant to the
After finding the specified text node, "zabcz" (lets call this text
node: to_be_replaced), I want to replace it with "za<text:span
That is: Text node "za", element node with text child, text node "cz".
The process by which I'm adding this new element, is by creating a new
xml document with a temp root node.
I then add this new document to the original document as a child, of
the parent of "to_be_replaced". (lets call this parent, foster_parent)
You need to import it. You can't simply add nodes originating in another
But you don't need an additional document, which makes things more
complicated. All you need is to add three nodes in the right position.
(1) Remove the node you want to replace.
(2) Find out whether or not there are more nodes after your insertion
point. If so, use insertBefore(); if not, simply use append().
(3) Create your nodes as you go using the very same document you want
to adopt them.
] [Thread Prev