[xml] manipulating tree causes Seg fault
- From: Nick Lang <nick lang propylon com>
- To: xml gnome org
- Subject: [xml] manipulating tree causes Seg fault
- Date: Tue, 11 Aug 2009 16:59:35 -0500
Hello,
What I've got going on here is this:
I have an XML document.
my regex search = "(.a)(b)(c.)"
to be replaced with: replace = "\\1<text:span
text:style-name='bold'>\\2</text:span>\\3"
using the following namespace =
"""xmlns:text="http://openoffice.org/2000/text" """
so essentially we have this
before:
zabcz
after:
za<text:span text:style-name='bold'>b</text:span>cz
In order to accomplish this I created a new doc, with root element <a>
and the namespace as specified above.
Next I do the regex search and replace and everything is honky-doory.
The next step is to remove the <a> element.
So what i've done is created a function to collect all the children of
<a>, unlink them, and then link them to the parent of <a>.
What happens after I do this though, is quite a disaster. In the
processing framework I use, it causes python to seg fault (every time)
I've removed all the "fluff" around the original component, and write
some code that deals directly with this problem.
After I did that, I find python blowing up, and spamming the screen with
memory allocation errors. (not sure if the seg fault and this are
related but could be).
So, obviously what's happening here is when I'm adding in this new tree
via a regex route, and then unlinking nodes and relinking nodes, the
pointers for these nodes are getting screwed up.
Now I know that there might be a problem with my code as well, and if
anyone wants to see it please let me know.
But if you know that this is an issue with libxml2 that'd be good to
know as well!
thanks
Nick
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]