Processing Instructions

XML, just like SGML, is descriptive markup; the idea is that you mark things up with labels that say only what they are, not how they should be processed. This buys you all sorts of good things such as flexibility and application-independence.

On the other hand, in the real world, it is often very useful to post a yellow-sticky on a document saying "this is where the background music comes in" or "last time they edited, this was at the top of the screen", or the like.

Processing Instructions (usually called PIs) are the solution. They are in the document, but are not part of the data. They have to begin with a Name, which is supposed to identify the application that might be interested in this PI.

Of course, finding names for things is tricky; that's why the spec recommends that you use a Notation name, which has an associated URI.

The spec says nothing about the content of a PI, aside from the fact that it extends up to the string ?>. However, XML itself uses some PI-like constructs, for example the XML declaration, and in those it uses a syntax much like that of a start-tag. While not compulsory, this seems like a good idea just for consistency.

Back-link to spec

Copyright © 1998, Tim Bray. All rights reserved.