Processing Instructions
In HTML, comments are sometimes abused to support
nonstandard extensions. For instance, the contents of the script
element are sometimes enclosed in a
comment to protect it from display by a nonscript-aware browser. The
Apache web server parses comments in .shtml files to recognize server-side
includes. Unfortunately, these documents may not survive being passed
through various HTML editors and processors with their comments and
associated semantics intact. Worse yet, it’s possible for an innocent
comment to be misconstrued as input to the application.
XML provides the processing instruction as
an alternative means of passing information to particular applications
that may read the document. A processing instruction begins with
<?
and ends with ?>
.
Immediately following the <?
is
an XML name called the target , possibly the name of the application for which this
processing instruction is intended or possibly just an identifier for
this particular processing instruction. The rest of the processing
instruction contains text in a format appropriate for the applications
for which the instruction is intended.
For example, in HTML, a robots META
tag is used to tell search-engine and
other robots whether and how they should index a page. The following
processing instruction has been proposed as an equivalent for XML
documents:
<?robots index="yes" follow="no"?>
The target of this processing instruction is robots
. The syntax of this particular processing instruction ...
Get XML in a Nutshell, 3rd Edition 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.