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

Bug#882582: xmldiff: wrong result on small change - xmldiff removes text node



Package: xmldiff
Version: 0.6.10-2+b1
Severity: important

Dear Maintainer,

Given the following small example, xmldiff removes text nodes (new: /section[1]/para[1]/#text()[2]).

Old XML:
--------
<?xml version="1.0" encoding="utf-8"?>
<section xmlns="http://docbook.org/ns/docbook"; version="5.0" xml:lang="en">
  <title>/section[1]/title[1]/#text()[1]</title>
  <para>/section[1]/para[1]/#text()[1]</para>
  <para>/section[1]/para[2]/#text()[1]</para>
</section>

New XML:
--------
<?xml version="1.0" encoding="utf-8"?>
<section xmlns="http://docbook.org/ns/docbook"; version="5.0" xml:lang="en">
  <title>/section[1]/title[1]/#text()[1]</title>
  <para>/section[1]/para[1]/#text()[1]
    <emphasis>/section[1]/para[1]/emphasis[1]/#text()[1]</emphasis>
    /section[1]/para[1]/#text()[2]
  </para>
</section>

Xmldiff yields the following xupdate:
------------------------------------
<?xml version="1.0"?>
<xupdate:modifications xmlns:xupdate="http://www.xmldb.org/xupdate"; xmlns="http://docbook.org/ns/docbook"; version="1.0">
	<xupdate:insert-after select="/section[1]/title[1]">
		<xupdate:element name="para">/section[1]/para[1]/#text()[2]</xupdate:element>
	</xupdate:insert-after>
	<xupdate:update select="/section[1]/para[2]/text()[1]">/section[1]/para[1]/#text()[1]</xupdate:update>
	<xupdate:rename select="/section[1]/para[3]">emphasis</xupdate:rename>
	<xupdate:remove select="/section[1]/emphasis[1]"/>
	<xupdate:insert-after select="/section[1]/para[1]/text()[1]">
		<xupdate:element name="emphasis">/section[1]/para[1]/emphasis[1]/#text()[1]</xupdate:element>
	</xupdate:insert-after>
	<xupdate:update select="/section[1]/para[1]/emphasis[1]/text()[1]">/section[1]/para[1]/emphasis[1]/#text()[1]</xupdate:update>
	<xupdate:remove select="/section[1]/para[2]"/>
</xupdate:modifications>

Expected output
---------------
After applying all modifications, the expected output should be identical to the document given under "New XML".

Observed output
---------------
The ouput produced lacks the second text node in the first paragraph.

The only workaround I have found so far is to initially wrap the first text node in "New XML" (/section[1]/para[1]/#text()[1])
with a fake element. This might work for this case. However, not sure if this has other negative implications otherwise.

Any help or insight is highly appreciated.

Thank you,
Frank

-- System Information:
Debian Release: 8.9
  APT prefers oldstable-updates
  APT policy: (500, 'oldstable-updates'), (500, 'oldstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.49-moby (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Init: unable to detect

Versions of packages xmldiff depends on:
ii  libc6           2.19-18+deb8u10
ii  python          2.7.9-1
ii  python-support  1.0.15

xmldiff recommends no packages.

Versions of packages xmldiff suggests:
pn  python-psyco    <none>
ii  xmldiff-xmlrev  0.6.10-2

-- no debconf information


Reply to: