InsertProcessInstruction method: XmlNode class
Syntax
InsertProcessInstruction(Target, Data, Position)
Description
Use the InsertProcessInstruction method to insert a processing instruction to an XmlNode at the location specified by Position.
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 to be used with the instruction. |
|
Position |
Specify where you want to insert the process instruction, as a number. |
Returns
A reference to the newly created processing instruction.
Example
For example:
Local XmlDoc &inXMLDoc;
Local XmlNode &procInst;
&inXMLDoc = CreateXmlDoc("<?xml version='1.0'?><root/>");
&procInst = &inXMLDoc.DocumentElement.AddProcessInstruction("first", "firstvalue");
&procInst = &inXMLDoc.DocumentElement.AddProcessInstruction("second",⇒
"secondvalue");
&procInst = &inXMLDoc.DocumentElement.InsertProcessInstruction("third",⇒
"thirdvalue", 2);
This is the XML document before the insert:
<?xml version="1.0"?>
<root>
<?first firstvalue?>
<?second secondvalue?>
</root>
This is the XML document after the insert:
<?xml version="1.0"?>
<root>
<?first firstvalue?>
<?third thirdvalue?>
<?second secondvalue?>
</root>
Related Topics