After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 300263 - xmllint inconsistent reformatting
xmllint inconsistent reformatting
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
2.6.19
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-04-11 22:32 UTC by Éric Bischoff
Modified: 2006-10-12 16:23 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Éric Bischoff 2005-04-11 22:32:25 UTC
Consider the following two files: 
 
=========== foo.xml ============ 
<?xml version="1.0" ?> 
<para> 
      <application id="idx-nedit">Nedit</application> est particulièrement 
simple à utiliser 
      (<foreignphrase lang="lat">cf.</foreignphrase> <xref 
linkend="fig-nedit" />). 
</para> 
================================ 
 
=========== bar.xml ============ 
<?xml version="1.0" ?> 
<para> 
      Nedit est particulièrement 
      simple à utiliser 
      (<foreignphrase lang="lat">cf.</foreignphrase> <xref 
linkend="fig-nedit" />). 
</para> 
================================ 
 
When running xmllint --format foo.xml, the output contains _no_ space 
between </foreingphrase> and <xref>. 
 
When running xmllint --format bar.xml, the output contains one space 
between </foreingphrase> and <xref>. 
 
I can't figure out any reason why they don't behave the same way. I suppose 
the correct version is with one space.
Comment 1 Daniel Veillard 2006-10-12 16:23:53 UTC
the reason is the heuristc used to try to detect mixed-content
in the absence of a DTD. It was behaving weirdly in this specific
case, I added a systematic way to detected non-space strings
added at one element level in the parser, and this now behave as it
should:

paphio:~/XML -> xmllint --format bar.xml
<?xml version="1.0"?>
<para>
      Nedit est particuli&#xE8;rement
      simple &#xE0; utiliser
      (<foreignphrase lang="lat">cf.</foreignphrase> <xref linkend="fig-nedit"/>).
</para>
paphio:~/XML -> xmllint --format foo.xml
<?xml version="1.0"?>
<para><application id="idx-nedit">Nedit</application> est particuli&#xE8;rement
simple &#xE0; utiliser
      (<foreignphrase lang="lat">cf.</foreignphrase> <xref linkend="fig-nedit"/>).
</para>
paphio:~/XML ->

  thanks for the report !

Daniel