[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] computeroutput vs screen vs xmllint
Stefan, On Tue, Sep 11, 2012 at 10:01 AM, Stefan Hinz <stefan.hinz@oracle.com> wrote: >> We are internally using different docbook editors (vi, emacs, serna >> and xmlmind). To some extent, we would like to preserve a nice and >> clear history of revision of our XML files in SVN (subversion). For >> this we use a script based on xmllint --format to reformat to a unique >> presentation. This has work quite well until today. Could someone >> please let me know if the following situation is an issue with either >> XML or docbook itself: >> >> <?xml version="1.0" encoding="UTF-8"?> >> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" >> "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> >> <article> >> <section> >> <title>Introduction</title> >> <para>Before</para> >> <screen><computeroutput>a.txt >> b.txt >> </computeroutput> >> </screen> >> <para>After</para> >> </section> >> </article> >> >> while xmllint --format prefers: >> >> <?xml version="1.0" encoding="UTF-8"?> >> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" >> "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> >> <article> >> <section> >> <title>Introduction</title> >> <para>Before</para> >> <screen> >> <computeroutput>a.txt >> b.txt >> </computeroutput> >> </screen> >> <para>After</para> >> </section> >> </article> > > > The latter is wrong. Stuff within "verbatim" containers such as <screen> or > <programlisting> shouldn't be re-formatted at all, but rather preserved as > is. > > I'd suggest using Paul DuBois' XML Formatter which does what it's supposed > to do. It's included in many Linux distros already, but if it's not in yours > (or if you're not using Linux) you can find it here: > > http://www.kitebird.com/software/xmlformat/ $ wget http://www.kitebird.com/software/xmlformat/xmlformat-1.04.tar.gz $ tar xvfz xmlformat-1.04.tar.gz $ cd xmlformat-1.04 $ cp xmlformat.pl /usr/local/bin/xmlformat $ xmlformat input.xml > new.xml $ cat new.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> <article> <section> <title>Introduction</title> <para>Before</para> <screen> <computeroutput>a.txt b.txt </computeroutput> </screen> <para>After</para> </section> </article> This is *exactly* what I am trying to avoid. xmllint and xmlformat seems to produce the exact same output. Is it working as supposed on your machine ? Which version are you using ? Thanks again, -- Mathieu
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]