Misuse of Processing Instructions

Clearly, processing instructions should not be used for information that is properly part of the domain of the XML application. For example, it would be inappropriate to use processing instructions to specify when and where a particular chess game was played. Markup like the following is to be eschewed.

<?xml version="1.0"?>
<?game-info date="2003-10-24" white="Jane Smith"
                              black="Alice Jones"?>
<game>
  <move>f3</move>
  <move>e5</move>
  <move>g4</move>
  <move>Qh4++</move>
</game>

Instead, additional elements and attributes should be added to the vocabulary to encode the additional information.

 <?xml version="1.0"?> <game> <date>2003-10-24</date> <white>Jane Smith</white> <black>Alice Jones</black> <move>f3</move> ...

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.