Processing Instructions
Home ] Up ] The Document Prolog ] XML Elements ] The Root Element ] XML Attributes ] Attribute vs. Element? ] Whitespace and Comments ] XML Character Entities ] CDATA Sections ] [ Processing Instructions ] Well-Formed Documents ]

 

 

XML provides the processing instruction as a means of passing information to particular applications that may read the document.

A processing instruction starts with <? and ends with ?>. Immediately following the <? is an XML name, called the target. The target could perhaps be the name of the application for which the processing instruction is intended, or it could be merely an identifier for this particular processing instruction.

Examples include:

  • <?robots index="yes" follow="no"?>

    In HTML, the tag:

    <meta name="ROBOTS" content="NOINDEX, NOFOLLOW">

    is used to tell search engines  (and other robots) whether and how they should index a page. the <?robots ... ?> XML processing instruction has been proposed as an equivalent for XML documents (see http://www.atrus.org/writings/technical/robots_pi/spec-199912__/ )

  • <?php phpinfo(); ?>

    In PHP, this processing instruction contains a call to a PHP function which returns an HTML page full of information on how PHP was installed on its web server.

    In PHP, one often embeds a significant amount of PHP code inside a <?php ... ?> processing instruction.

  • <?mso-application progid="InfoPath.Document"?>

    The Microsoft application InfoPath uses this processing instruction to indicate that the XML file should be viewed within the InfoPath client. 

 
The page was last updated February 19, 2008