GNOME Bugzilla – Bug 300263
xmllint inconsistent reformatting
Last modified: 2006-10-12 16:23:53 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.
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èrement simple à 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èrement simple à utiliser (<foreignphrase lang="lat">cf.</foreignphrase> <xref linkend="fig-nedit"/>). </para> paphio:~/XML -> thanks for the report ! Daniel