[xml] Merging of TextNodes




Hi there,

I do have a question related to the merging of text nodes when using xmlAddNextSibling. Many thanks in advance for any help.

The situation the the following: I already got two child nodes:

Comment1 with name "comment" and XML_COMMENT_NODE type
and
Text1 with name "text" and XML_TEXT_NODE type

When I am inserting node
Text2 with name "text" and XML_TEXT_NODE type
 with xmlAddNextSibling.( Comment1, Text2), the TextNodes Text1 and Text2 are not merged. I would have expected them to be merged into one node.

When I look at tree.c in function  xmlAddNextSibling, the case where the cur and elem node are TextNodes is handled first (not the case here) and the next case should be that cur->next and elem are TextNodes. However, the (cur->name == cur->next->name) clause prevents the merge. These are "comment" and "text" in this case.

Have I misunderstood the need to merge the two TextNodes in this case? Why is there a comparision of the names in the first place? I would have assumed comparing the node types would be sufficient.

Any help would be very welcome.

Cheers

Uwe

i.A. Dr. Uwe KÃhler

Tel.: +49 (0) 251 490 943 17
OneVision Software Entwicklungs GmbH & Co. KG
Servatiiplatz 7-9 â 48143 MÃnster
Sitz der Gesellschaft: Regensburg
PersÃnlich haftende Gesellschafterin:
OneVision Software Entwicklungs Verwaltungs GmbH
Dr.-Leo-Ritter-Strasse 9, 93049 Regensburg
Sitz der Gesellschaft: Regensburg
Handelsregister: HRB 8932, Amtsgericht Regensburg
GeschÃftsfÃhrer: Dr. Patrick Herzog, Andreas Besser


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]