Re: [xml] Adjacent text node merging



On Sat, May 04, 2013 at 11:59:50AM +0400, Nikolay Sivov wrote:
I think it's more a question for Daniel, but any help is welcome of
course. Libxml2 merges text nodes to a single node when you add text
child next to existing text node for example, so at least
xmlAddNextSibling, xmlAddPrevSibling and xmlAddChild are doing that.
For a project I'm using libxml2 I want all nodes to be preserved as
I add them, so for example I can edit text content of particular
text node in children list. The question is what could or will
potentially break if I'll use my own versions of these tree
manipulation calls that do not perform such merging? e.g. does a lib
really expect to have only one text node with no text siblings
somewhere in the code, or maybe libxslt does?

  The main reason for this is the XPath data model which basically
assumes there is no adjacent text nodes (well it also removes CDATA
ones and turn them to text too). If you do this you may get incoherent
XPath results, but that's true too if you keep CDATA nodes...
  There is no hard expectation at the code level, just XPath results
may turn a bit weird.

Patch applied, thanks, that's #1 :-) !

Daniel

-- 
Daniel Veillard      | Open Source and Standards, Red Hat
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | virtualization library  http://libvirt.org/


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