Example usage for javax.xml.transform Result PI_ENABLE_OUTPUT_ESCAPING

List of usage examples for javax.xml.transform Result PI_ENABLE_OUTPUT_ESCAPING

Introduction

In this page you can find the example usage for javax.xml.transform Result PI_ENABLE_OUTPUT_ESCAPING.

Prototype

String PI_ENABLE_OUTPUT_ESCAPING

To view the source code for javax.xml.transform Result PI_ENABLE_OUTPUT_ESCAPING.

Click Source Link

Document

The name of the processing instruction that is sent if the result tree enables output escaping at some point after having received a PI_DISABLE_OUTPUT_ESCAPING processing instruction.

Usage

From source file:net.sf.joost.emitter.XmlEmitter.java

/**
 * SAX2-Callback - Outputs a PI//from   w w w.j  av a2  s  . co  m
 */
public void processingInstruction(String target, String data) throws SAXException {
    processLastElement(false);

    if (supportDisableOutputEscaping) {
        if (Result.PI_DISABLE_OUTPUT_ESCAPING.equals(target)) {
            disabledOutputEscaping = true;
            return;
        } else if (Result.PI_ENABLE_OUTPUT_ESCAPING.equals(target)) {
            disabledOutputEscaping = false;
            return;
        }
    }

    try {
        writer.write("<?");
        writer.write(target);

        if (!data.equals("")) {
            writer.write(" ");
            writer.write(data);
        }

        writer.write("?>");
    } catch (IOException ex) {
        if (log != null)
            log.error(ex);
        throw new SAXException(ex);
    }
}