Re: [xml] Possible bug on content addition then node deletion.
- From: Jose Commins <axora myrealbox com>
- To: xml gnome org
- Subject: Re: [xml] Possible bug on content addition then node deletion.
- Date: Fri, 26 Nov 2004 09:05:43 +0000
On 24 Nov 2004, at 10:42, Kasimier Buchcik wrote:
No, in my example both text pieces are hold by adjacent text nodes;
please examine the resulting tree structure!
to 'Something' as content; with xmlReadMemory it isn't, it is
separated into a separate text node.
This is an expected behaviour for a DOM tree; have a look at the
'Text' interface of the DOM API [1].
I shall have to concatenate adjacent text nodes myself, then...
Concatenation of adjacent text nodes is done by xmlNodeGetContent.
The 'content' field for element nodes is always NULL.
Please have a look at the table describing the return values for
'nodeValue' for DOM [2], it reflects the 'content' field for libxml2
element nodes.
The behaviour of the xmlReader is correct here.
After comparing the trees generated by your code and mine, I see your
point. I didn't realise that text nodes can end up chained together in
this manner, hence I (wrongly) assumed that I could have been seeing a
bug. I am now using 'xmlTextMerge' to join the relevant text nodes as
I am pruning a node which does not allow xmlNodeGetContent to join the
text nodes I need.
Thanks for your input and valuable help on this Kasimier! What I
though was a bug turned out to be an implementation issue I was not
familiar with.
Regards,
Jose.
--
Arguing with an engineer is like wrestling with a pig in mud.
After a while, you realize the pig is enjoying it.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]