Name

createProcessingInstruction: target, data

Synopsis

This creates a new ProcessingInstruction node with the given target name and data values. The processing instruction target name “xml” (case-insensitive) is reserved and can’t be used by an application.

Arguments

target: DOMString

The target name of the processing instruction.

data: DOMString

The application-specific data for the resulting ProcessingInstruction node.

Exceptions

INVALID_CHARACTER_ERR

Indicates that the name you passed in to createProcessingInstruction is not a legal XML name. See Chapter 2 for the XML restrictions on name construction.

NOT_SUPPORTED_ERR

Generated if you attempt to create a ProcessingInstruction using an HTML document.

Java binding

public ProcessingInstruction createProcessingInstruction(String target,
                                String data) throws DOMException;

Java example

// Add the application-specific processing instruction
ProcessingInstruction pi = doc.createProcessingInstruction("my_app",
            "action=\"save\"");

Get XML in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.