Name

data: DOMString

Synopsis

Returns the data portion of this processing instruction. The data portion is identified starting at the first nonwhitespace character after the target token and ending at the closing ?>.

Write exception

NO_MODIFICATION_ALLOWED_ERR

Raised if the node is read-only.

Java bindings

public String getData( );
public void setData(String data) throws DOMException;

Java example

// Check the application's data attribute
if (pi.getTarget( ) =  = "MY_APPLICATION") {
    // check the data attribute for my own application-specific info
    if (pi.getData( ) =  = "CHECK_SIBLINGS") {
        // check the siblings
        ...
    }
     
    pi.setData("SIBLINGS_CHECKED");
}

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.