Ignorable White Space

Another special case that really isn't all that special is white space in element content, sometimes misleadingly called ignorable white space. This is white space in an element whose element declaration specifies that it can contain only child elements and not PCDATA. For example, suppose the PhoneNumber element has the following declaration.

<!ELEMENT PhoneNumber (CountryCode, AreaCode, Number)>

Now consider the valid PhoneNumber element below.

<PhoneNumber>
  <CountryCode>01</CountryCode>
  <AreaCode>212</ AreaCode >
  <Number>555-1234</ Number >
</PhoneNumber>

Because the DTD says this element can only contain these three child elements, the white space is ignorable. It is assumed to exist only for formatting and not to ...

Get Effective XML: 50 Specific Ways to Improve Your XML 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.