This documentation is archived and is not being maintained.

XML Processing Instruction Literal (Visual Basic)

A literal representing an XProcessingInstruction object.

<?piName [ = piData ] ?>


Required. Denotes the start of the XML processing instruction literal.


Required. Name indicating which application the processing instruction targets. Cannot begin with "xml" or "XML".


Optional. String indicating how the application targeted by piName should process the XML document.


Required. Denotes the end of the processing instruction.

XML processing instruction literals indicate how applications should process an XML document. When an application loads an XML document, the application can check the XML processing instructions to determine how to process the document. The application interprets the meaning of piName and piData.

The XML document literal uses syntax that is similar to that of the XML processing instruction. For more information, see XML Document Literal (Visual Basic).


The piName element cannot begin with the strings "xml" or "XML", because the XML 1.0 specification reserves those identifiers.

You can assign an XML processing instruction literal to a variable or include it in an XML document literal.


An XML literal can span multiple lines without needing line continuation characters. This enables you to copy content from an XML document and paste it directly into a Visual Basic program.

The Visual Basic compiler converts the XML processing instruction literal to a call to the XProcessingInstruction constructor.

The following example creates a processing instruction identifying a style-sheet for an XML document.

Dim pi As XProcessingInstruction = 
  <?xml-stylesheet type="text/xsl" href="show_book.xsl"?>