Re: xmltool indent inserting lines?

Hussein Shafie <[email protected]>
Newsgroups gmane.editors.xxe.general
Message-ID <[email protected]>
On 4/14/21 7:09 PM, Tim Trese wrote:
> Hellos.
> 
> I am attempting to use the xmltool indent option to prettify DocBook 5.1 
> files. As it stands, the following command line and response produce 
> undesired artifacts in the output:
> 
> [dos prompt]> xmltool indent -indent 2 -maxlinelength 78 -v -o 
> ./manual/4-wire-bridging-submodule.xml 
> ./manual/4-wire-bridging-submodule.xml
> 
> Loading document ".\manual\4-wire-bridging-submodule.xml"...
> 
> WARNING: Cannot determine which schema to use for validating 
> ".\manual\4-wire-bridging-submodule.xml".

This WARNING is important.

> 
> Saving document ".\manual\4-wire-bridging-submodule.xml" to 
> ".\manual\4-wire-bridging-submodule.xml"...
> 
> Given the following excerpted example input:
> 
>      <para>The Four-Wire (4W) Bridging Voice Frequency (VF) Submodule, 
> shown in[CR][LF]
> 
>      <xref linkend="fig-4wbridge-submodule-leds"/>, provides the 
> capability to[CR][LF]
> 
>      bridge two four-wire electric circuits. Connections to the circuit 
> are[CR][LF]
> 
>      made using a standard RJ45 connector.</para>[CR][LF]
> 
> [CR][LF]
> 
>      <figure xml:id="fig-4wbridge-submodule-leds">[CR][LF]
> 
>        <title>4W Bridging Submodule (LEDs Indicated)</title>[CR][LF]
> 
> The resulting output from xmltool is:
> 
>      <para>The Four-Wire (4W) Bridging Voice Frequency (VF) Submodule, 
> shown in[LF]
> 
>      <xref linkend="fig-4wbridge-submodule-leds"/>, provides the 
> capability to[LF]
> 
>      bridge two four-wire electric circuits. Connections to the circuit 
> are[LF]
> 
>      made using a standard RJ45 connector.</para>[LF]
> 
> [LF]
> 
>      [LF]
> 
> [LF]
> 
>      [LF]
> 
> [LF]
> 
>      <figure xml:id="fig-4wbridge-submodule-leds">[LF]
> 
>        [LF]
> 
>        [LF]
> 
> [LF]
> 
>        <title>4W Bridging Submodule (LEDs Indicated)</title>[LF]
> 
> Carriage returns [CR] and line feeds [LF] are indicated above for 
> clarity. The output conversion to UNIX line endings is fine, but the 
> insertion of extra lines between elements is not desired.
> 
> The documentation for xmltool does not appear to provide any option for 
> regulating line insertion between elements. Is there a way to turn this 
> “feature” off, or what am I doing wrong?
> 

xmltool uses the schema to determine 1) where it can remove ignoreable 
whitespace from the input document and 2) where it can safely add 
ignoreable whitespace, that is, the indentation and newlines.

Without a schema, you simply cannot get any satisfactory result.

Please try:

C:\xxx\> xmltool indent -s 
XXE_INSTALL_DIR\addon\config\docbook51\rng\V5.1\docbook.rng -indent 2 
-maxlinelength 78 -v -o manual\4-wire-bridging-submodule.xml 
manual\4-wire-bridging-submodule.xml

Notice the extra "-s 
XXE_INSTALL_DIR\addon\config\docbook51\rng\V5.1\docbook.rng" option.

***********************************************************************
--> However, It's really not a good idea to overwrite your input file!

C:\xxx\> xmltool indent -s 
XXE_INSTALL_DIR\addon\config\docbook51\rng\V5.1\docbook.rng -indent 2 
-maxlinelength 78 -v manual\4-wire-bridging-submodule.xml

will create indented "manual\4-wire-bridging-submodule.xml" and save 
original file as "manual\4-wire-bridging-submodule.xml.BAK".
***********************************************************************

More information in 
http://www.xmlmind.com/xmleditor/_distrib/doc/xmltool/indent_options.html



--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.