Example usage for org.xml.sax.ext LexicalHandler comment

List of usage examples for org.xml.sax.ext LexicalHandler comment

Introduction

In this page you can find the example usage for org.xml.sax.ext LexicalHandler comment.

Prototype

public abstract void comment(char ch[], int start, int length) throws SAXException;

Source Link

Document

Report an XML comment anywhere in the document.

Usage

From source file:FastStringBuffer.java

/**
 * Sends the specified range of characters as sax Comment.
 * <p>//from  ww w. java  2s.com
 * Note that, unlike sendSAXcharacters, this has to be done as a single 
 * call to LexicalHandler#comment.
 *
 * @param ch SAX LexicalHandler object to receive the event.
 * @param start Offset of first character in the range.
 * @param length Number of characters to send.
 * @exception org.xml.sax.SAXException may be thrown by handler's
 * characters() method.
 */
public void sendSAXComment(org.xml.sax.ext.LexicalHandler ch, int start, int length)
        throws org.xml.sax.SAXException {

    // %OPT% Do it this way for now...
    String comment = getString(start, length);
    ch.comment(comment.toCharArray(), 0, length);
}