com.nwalsh.saxon6
Class LineCountEmitter

java.lang.Object
  |
  +--com.nwalsh.saxon6.LineCountEmitter

public class LineCountEmitter
extends java.lang.Object
implements com.icl.saxon.output.Emitter

Saxon extension to count the lines in a result tree fragment.

$Id: LineCountEmitter.java,v 1.2 2000/11/28 23:05:55 ndw Exp $

Copyright (C) 2000 Norman Walsh.

This class provides a Saxon 6.* implementation to count the number of lines in a result tree fragment.

The general design is this: the stylesheets construct a result tree fragment for some verbatim environment. That result tree fragment is "replayed" through the LineCountEmitter; the LineCountEmitter watches characters go by and counts the number of line feeds that it sees. That number is then returned.

Change Log:

1.0

Initial release.

See Also:
Verbatim

Constructor Summary
LineCountEmitter()
          Construct a new LineCountEmitter.
 
Method Summary
 void characters(char[] chars, int start, int len)
          Process characters.
 void comment(char[] chars, int start, int length)
          Discarded.
 void endDocument()
          Discarded.
 void endElement(int nameCode)
          Discarded.
 int lineCount()
          Return the number of lines.
 void processingInstruction(java.lang.String name, java.lang.String data)
          Discarded.
 void reset()
          Reset the number of lines.
 void setCharacterSet(com.icl.saxon.output.CharacterSet charset)
          Discarded.
 void setDocumentLocator(org.xml.sax.Locator locator)
          Discarded.
 void setEscaping(boolean escaping)
          Discarded.
 void setNamePool(com.icl.saxon.om.NamePool namePool)
          Discarded.
 void setOutputDetails(com.icl.saxon.output.OutputDetails details)
          Discarded.
 void setUnparsedEntity(java.lang.String name, java.lang.String uri)
          Discarded.
 void setWriter(java.io.Writer writer)
          Discarded.
 void startDocument()
          Discarded.
 void startElement(int nameCode, org.xml.sax.Attributes attributes, int[] namespaces, int nscount)
          Discarded.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineCountEmitter

public LineCountEmitter()
Construct a new LineCountEmitter.
Method Detail

reset

public void reset()
Reset the number of lines.

lineCount

public int lineCount()
Return the number of lines.

characters

public void characters(char[] chars,
                       int start,
                       int len)
                throws org.xml.sax.SAXException
Process characters.
Specified by:
characters in interface com.icl.saxon.output.Emitter

comment

public void comment(char[] chars,
                    int start,
                    int length)
             throws org.xml.sax.SAXException
Discarded.
Specified by:
comment in interface com.icl.saxon.output.Emitter

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Discarded.
Specified by:
endDocument in interface com.icl.saxon.output.Emitter

endElement

public void endElement(int nameCode)
                throws org.xml.sax.SAXException
Discarded.
Specified by:
endElement in interface com.icl.saxon.output.Emitter

processingInstruction

public void processingInstruction(java.lang.String name,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
Discarded.
Specified by:
processingInstruction in interface com.icl.saxon.output.Emitter

setCharacterSet

public void setCharacterSet(com.icl.saxon.output.CharacterSet charset)
                     throws org.xml.sax.SAXException
Discarded.
Specified by:
setCharacterSet in interface com.icl.saxon.output.Emitter

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Discarded.
Specified by:
setDocumentLocator in interface com.icl.saxon.output.Emitter

setEscaping

public void setEscaping(boolean escaping)
                 throws org.xml.sax.SAXException
Discarded.
Specified by:
setEscaping in interface com.icl.saxon.output.Emitter

setNamePool

public void setNamePool(com.icl.saxon.om.NamePool namePool)
Discarded.
Specified by:
setNamePool in interface com.icl.saxon.output.Emitter

setOutputDetails

public void setOutputDetails(com.icl.saxon.output.OutputDetails details)
                      throws org.xml.sax.SAXException
Discarded.
Specified by:
setOutputDetails in interface com.icl.saxon.output.Emitter

setUnparsedEntity

public void setUnparsedEntity(java.lang.String name,
                              java.lang.String uri)
                       throws org.xml.sax.SAXException
Discarded.
Specified by:
setUnparsedEntity in interface com.icl.saxon.output.Emitter

setWriter

public void setWriter(java.io.Writer writer)
               throws org.xml.sax.SAXException
Discarded.
Specified by:
setWriter in interface com.icl.saxon.output.Emitter

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Discarded.
Specified by:
startDocument in interface com.icl.saxon.output.Emitter

startElement

public void startElement(int nameCode,
                         org.xml.sax.Attributes attributes,
                         int[] namespaces,
                         int nscount)
                  throws org.xml.sax.SAXException
Discarded.
Specified by:
startElement in interface com.icl.saxon.output.Emitter