This page is Almost Ready

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

createProcessingInstruction

Summary

Creates a processing instruction for an XML parser.

Method of dom/Documentdom/Document

Syntax

var processingInstruction = document.createProcessingInstruction(target, data);

Parameters

target

Data-type
String

The name of the processing instruction.

data

Data-type
String

The data for the processing instruction.

Return Value

Returns an object of type DOM NodeDOM Node

The created processing instruction.

Examples

The following code example demonstrates how to create an XML processing instruction.

// This example creates the following processing instruction:
//   <?xml-stylesheet type="text/css" href="style.css">
var sTarget = 'xml-stylesheet';
var sData = 'type="text/css" href="style.css"';'
var obj = document.createProcessingInstruction(sTarget, sData);

Notes

The createProcessingInstruction method is supported only for XML documents.

Related specifications

DOM Level 3 Core
Recommendation

Attributions