PRETTYPRINT

Synopsis

HELP:   Indentation of XML tags for human readability
TYPE:   OBJECT
SYNTAX: PRETTYPRINT(MAXWSP=num,WSPERR=WRITE/ABORT,INDSIZ=num,INDCHR=SPACE/TABULATOR,NOCMNT,BUFSIZ=num,INICNT=num,WLLFMD)

Description

The pretty printing method creates an XML document that is very suitable to be read by humans. All XML elements start on its own line and are properly indented occording to its hierarchical position, unless they are surrounded by text data. Elements containing actual text (i.e. they do not only contain whitespace and newlines) have all their whitespace and newline characters preserved.

Example: If the original XML document is the following one:

<?xml version="1.0"?>
     <!DOCTYPE root [
  <!ELEMENT root (someelement)>
           ]>
  <root>
                 <somelement   attribute1="value1" attribute2="value2">
    some text
   </somelement>
        <somelement>
    <!-- comment -->
           text in non-root element    <leaf>this is a leaf</leaf></somelement></root>

then pretty printing will result in the following document:

<?xml version="1.0"?>
<!DOCTYPE root [
  <!ELEMENT root (someelement)>
]>
<root>
  <somelement attribute1="value1" attribute2="value2">
    some text
   </somelement>
  <somelement>
    <!-- comment -->
           text in non-root element    <leaf>this is a leaf</leaf>
  </somelement>
</root>

Arguments