Example usage for org.w3c.dom ProcessingInstruction getNodeValue

List of usage examples for org.w3c.dom ProcessingInstruction getNodeValue

Introduction

In this page you can find the example usage for org.w3c.dom ProcessingInstruction getNodeValue.

Prototype

public String getNodeValue() throws DOMException;

Source Link

Document

The value of this node, depending on its type; see the table above.

Usage

From source file:com.marklogic.xcc.ValueFactory.java

/**
 * A convenience method to construct an {@link XdmProcessingInstruction} value. {@link XdmProcessingInstruction} objects can be
 * constructed from an XML {@link String}, a W3C DOM {@link ProcessingInstruction} node or an {@link InputStream}
 * .// w  ww  .  j av a  2 s  .co m
 * 
 * @param value
 *            An instance of {@link String}, {@link ProcessingInstruction} or {@link InputStream}.
 * @return An instance of {@link XdmProcessingInstruction}.
 * @throws IllegalArgumentException
 *             If value is not a {@link String}, {@link ProcessingInstruction} or {@link InputStream}.
 */
public static XdmProcessingInstruction newProcessingInstructionNode(Object value) {
    if (value instanceof String) {
        return new ProcessingInstructionImpl((String) value);
    }

    if (value instanceof InputStream) {
        return new ProcessingInstructionImpl((InputStream) value);
    }

    if (value instanceof ProcessingInstruction) {
        ProcessingInstruction c = (ProcessingInstruction) value;

        return new ProcessingInstructionImpl(c.getNodeValue());
    }

    throw new IllegalArgumentException(
            "String, org.w3c.dom.Text or InputStream value required to construct " + ValueType.TEXT);
}