XML-FORMAT - XML beautifier
is an XML beautifier that indents and formats XML files for
consistent line length.
As with all file beautifiers, its primary purpose is to take a document created
by someone with a perplexing lack of self-discipline and aesthetic sensibility
and make it readable.
The XML file is modified in place, and the original document is saved to
filename.bak, in case you don't like the results.
Since XML is a class of markup languages, not a markup language, the type of
each tag encountered is determined from the type of XML file (DocBook, XHTML,
etc.), which, in turn, is inferred from the filename extension
(".dbk" for DocBook, ".xhtml" for XHTML, etc.)
There are four types of tags:
denote blocks of content that should be visually separated
from others in the XML source, and often require multiple lines, such as
paragraphs, captions, and programlistings. Blocks are separated from other
content by a blank line. Content within a block is indented the same as the
The large forest planet Oglaroon is home to the Oglaroonians,
an "intelligent" species who maintain an entire civilisation,
including some extremely small wars, in one small nut tree,
believing it to be the entire universe, and other trees to be
merely Oglanut-induced illusions.
denote small but important content items that should be
highlighted, but not necessarily use multiple lines, such as titles and index
attempts to keep line tag items to a single, separate
<title>So Long, and Thanks for all the Fish</title>
denote structural components of a document, such as
chapters, sections, figures, and lists. Opening and closing sectioning tags
are placed alone on separate lines. Content between sectioning tags is
indented one more level beyond the tags themselves.
<title>Construction of Earth</title>
For a time in the distant past, fjords were fashionable...
All other tags that do not fall into the first three categories are considered
in-line, and are treated essentially as text, except that they are nestled
against the text they surround.
People were described as daring <emphasis>to boldly split
infinitives that no man had split before</emphasis>. However,
The type of each tag is determined from simple text files containing lists of
each tag name, on per line, in DATADIR/Config/language/<type>-tags.txt.
For example, the tags for DocBook XML are found in:
Please report bugs to the author and send patches in unified diff format. (Run
man diff for more information.)
Jason W. Bacon