docbook-apps

  • 1.  computeroutput vs screen vs xmllint

    Posted 09-10-2012 12:08
    Hi all,

    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:


    "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">



    <para>Before</para>
    <screen><computeroutput>a.txt
    b.txt
    </computeroutput>
    </screen>
    <para>After</para>



    while xmllint --format prefers:


    "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">



    <para>Before</para>
    <screen>
    <computeroutput>a.txt
    b.txt
    </computeroutput>
    </screen>
    <para>After</para>



    This leads to differences in the fo output with extra spaces. So how
    does one handles such corner cases ?

    Thanks much !
    --
    Mathieu



  • 2.  Re: [docbook-apps] computeroutput vs screen vs xmllint

    Posted 09-11-2012 08:01
    Bonjour Mathieu,

    > 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:
    >
    >
    > > "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
    >

    >

    >
    > <para>Before</para>
    > <screen><computeroutput>a.txt
    > b.txt
    > </computeroutput>
    > </screen>
    > <para>After</para>
    >

    >

    >
    > while xmllint --format prefers:
    >
    >
    > > "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
    >

    >

    >
    > <para>Before</para>
    > <screen>
    > <computeroutput>a.txt
    > b.txt
    > </computeroutput>
    > </screen>
    > <para>After</para>
    >

    >


    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/

    > This leads to differences in the fo output with extra spaces. So how
    > does one handles such corner cases ?

    By formatting (or not formatting) properly. :-)

    --
    Cheers,

    Stefan Hinz <stefan.hinz@oracle.com>, MySQL Documentation Manager

    Phone: +49-30-82702940, Fax: +49-30-82702941, http://dev.mysql.com/doc

    ORACLE Deutschland B.V.& Co. KG
    Registered Office: Riesstr. 25, 80992 Muenchen, Germany
    Commercial Register: Local Court Of Munich, HRA 95603
    Managing Director: Jürgen Kunz

    General Partner: ORACLE Deutschland Verwaltung B.V.
    Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
    Register Of Chamber Of Commerce: Midden-Niederlande, No. 30143697
    Managing Directors: Alexander van der Ven, Astrid Kepper, Val Maher



  • 3.  Re: [docbook-apps] computeroutput vs screen vs xmllint

    Posted 09-11-2012 08:15
    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:
    >>
    >>
    >> >> "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
    >>

    >>

    >>
    >> <para>Before</para>
    >> <screen><computeroutput>a.txt
    >> b.txt
    >> </computeroutput>
    >> </screen>
    >> <para>After</para>
    >>

    >>

    >>
    >> while xmllint --format prefers:
    >>
    >>
    >> >> "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
    >>

    >>

    >>
    >> <para>Before</para>
    >> <screen>
    >> <computeroutput>a.txt
    >> b.txt
    >> </computeroutput>
    >> </screen>
    >> <para>After</para>
    >>

    >>

    >
    >
    > 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

    "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">



    <para>Before</para>
    <screen>
    <computeroutput>a.txt
    b.txt
    </computeroutput>
    </screen>
    <para>After</para>




    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



  • 4.  Re: [docbook-apps] computeroutput vs screen vs xmllint

    Posted 09-11-2012 09:33
    Bonjour Mathieu,

    > 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:
    >>>
    >>>
    >>> >>> "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
    >>>

    >>>

    >>>
    >>> <para>Before</para>
    >>> <screen><computeroutput>a.txt
    >>> b.txt
    >>> </computeroutput>
    >>> </screen>
    >>> <para>After</para>
    >>>

    >>>

    >>>
    >>> while xmllint --format prefers:
    >>>
    >>>
    >>> >>> "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
    >>>

    >>>

    >>>
    >>> <para>Before</para>
    >>> <screen>
    >>> <computeroutput>a.txt
    >>> b.txt
    >>> </computeroutput>
    >>> </screen>
    >>> <para>After</para>
    >>>

    >>>

    >>
    >>
    >> 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
    >
    > > "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
    >

    >

    >
    > <para>Before</para>
    > <screen>
    > <computeroutput>a.txt
    > b.txt
    > </computeroutput>
    > </screen>
    > <para>After</para>
    >

    >

    >
    >
    > 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 ?

    Darn, sorry for that. :-(

    I guess xmlformat-1.04 still doesn't include the setting it includes in
    our setup here:

    atlas~/svn/mysqldoc-toolset/tools> grep screen xmlformat.conf
    programlisting literallayout synopsis screen

    In other words, add "screen" to the respective line of xmlformat.conf,
    and things should work properly.

    --
    Cheers,

    Stefan Hinz <stefan.hinz@oracle.com>, MySQL Documentation Manager

    Phone: +49-30-82702940, Fax: +49-30-82702941, http://dev.mysql.com/doc

    ORACLE Deutschland B.V.& Co. KG
    Registered Office: Riesstr. 25, 80992 Muenchen, Germany
    Commercial Register: Local Court Of Munich, HRA 95603
    Managing Director: Jürgen Kunz

    General Partner: ORACLE Deutschland Verwaltung B.V.
    Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
    Register Of Chamber Of Commerce: Midden-Niederlande, No. 30143697
    Managing Directors: Alexander van der Ven, Astrid Kepper, Val Maher



  • 5.  Re: [docbook-apps] computeroutput vs screen vs xmllint

    Posted 09-11-2012 09:45
    On Tue, Sep 11, 2012 at 11:33 AM, Stefan Hinz <stefan.hinz@oracle.com> wrote:
    > Bonjour Mathieu,
    >
    >
    >> 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:
    >>>>
    >>>>
    >>>> >>>> "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
    >>>>

    >>>>

    >>>>
    >>>> <para>Before</para>
    >>>> <screen><computeroutput>a.txt
    >>>> b.txt
    >>>> </computeroutput>
    >>>> </screen>
    >>>> <para>After</para>
    >>>>

    >>>>

    >>>>
    >>>> while xmllint --format prefers:
    >>>>
    >>>>
    >>>> >>>> "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
    >>>>

    >>>>

    >>>>
    >>>> <para>Before</para>
    >>>> <screen>
    >>>> <computeroutput>a.txt
    >>>> b.txt
    >>>> </computeroutput>
    >>>> </screen>
    >>>> <para>After</para>
    >>>>

    >>>>

    >>>
    >>>
    >>>
    >>> 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
    >>
    >> >> "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
    >>

    >>

    >>
    >> <para>Before</para>
    >> <screen>
    >> <computeroutput>a.txt
    >> b.txt
    >> </computeroutput>
    >> </screen>
    >> <para>After</para>
    >>

    >>

    >>
    >>
    >> 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 ?
    >
    >
    > Darn, sorry for that. :-(
    >
    > I guess xmlformat-1.04 still doesn't include the setting it includes in our
    > setup here:
    >
    > atlas~/svn/mysqldoc-toolset/tools> grep screen xmlformat.conf
    > programlisting literallayout synopsis screen
    >
    > In other words, add "screen" to the respective line of xmlformat.conf, and
    > things should work properly.

    magnificent !

    Thanks a bunch
    --
    Mathieu