AddProcessInstruction method: XmlNode class

Syntax

AddProcessInstruction(Target, Data)

Description

Use the AddProcessInstruction method to add a processing instruction to an XmlNode. The new process instruction is appended to the end of the child list.

To insert a processing instruction at a particular place, use the InsertProcessInstruction method instead.

A reference to the newly created processing instruction is returned.

Note:

You cannot use this method with a SoapDoc object.

Parameters

Parameter Description

Target

Specify the application to which the instruction is directed, as a string.

Data

Specify the data used with the processing instruction.

Returns

A reference to the newly created processing instruction.

Example

For example:

Local XmlDoc &inXMLDoc;
Local XmlNode &procInst;

&inXMLDoc = CreateXmlDoc("<?xml version='1.0'?><myroot/>");
&procInst = &inXMLDoc.DocumentElement.AddProcessInstruction("xml-stylesheet",⇒
 "href=""book.css"" type=""text/css""");

The preceding PeopleCode program produces the following XML :

<?xml version="1.0"?>
<myroot>
  <?xml-stylesheet href="book.css" type="text/css"?>
</myroot>