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
Microsoft Developer Network: [Windows Internet Explorer API reference Article]