Home > Articles > Web Services > XML

  • Print
  • + Share This
This chapter is from the book

1.5 Processing instructions

<?target data?>

Processing instructions are used to provide information to the application processing an XML document. Such information may include instructions on how to process the document, how to display the document, and so forth. Processing instructions can appear as children of elements. They can also appear as top-level constructs (children of the document) either before or after the document element.

Processing instructions are composed of two parts: the target or name of the processing instruction and the data or information. The syntax takes the form <?target data?>. The target follows the same construction rules as for element and attribute names. Apart from the termination character sequence (?>), all markup is ignored in processing instruction content. Processing instructions defined by organizations other than the World Wide Web Consortium (W3C) may not have targets that begin with the character sequence xml or any recapitalization thereof.

Namespace declarations do not apply to processing instructions. Thus, creating targets that are guaranteed to be unique is problematic.

Example

Processing instructions

<?display table-view?>
<?sort alpha-ascending?>
<?textinfo whitespace is allowed ?>
<?elementnames <fred>, <bert>, <harry> ?>

Various processing instructions

  • + Share This
  • 🔖 Save To Your Account