“Ignorable White Space”

One of the more obscure parts of the XML 1.0 specification is the perhaps misleadingly named “ignorable white space.” This is white space that occurs between tags in places where the DTD does not allow mixed content. Consider the XML-RPC document in Example 6.13.

Example 6.13. A Document That Uses Ignorable White Space to Prettify the XML
<?xml version="1.0"?>
<!DOCTYPE methodCall [
  <!ELEMENT methodCall (methodName, params)>
  <!ELEMENT params (param+)>
  <!ELEMENT param (value)>
  <!ELEMENT value (string)>
  <!ELEMENT methodName (#PCDATA)>
  <!ELEMENT string (#PCDATA)>
]>
<methodCall>
  <methodName>lookupSymbol</methodName>
  <params>
    <param>
      <value>
        <string>
          Red Hat
        </string>
      </value>
    </param>
  </params>
</methodCall>

This example ...

Get Processing XML with Java™: A Guide to SAX, DOM, JDOM, JAXP, and TrAX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.