com.nwalsh.saxon6
Class NumberLinesEmitter

java.lang.Object
  |
  +--com.nwalsh.saxon6.CopyEmitter
        |
        +--com.nwalsh.saxon6.NumberLinesEmitter

public class NumberLinesEmitter
extends CopyEmitter

Saxon extension to decorate a result tree fragment with line numbers.

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

Copyright (C) 2000 Norman Walsh.

This class provides the guts of a Saxon 6.* implementation of line numbering for verbatim environments. (It is used by the Verbatim class.)

The general design is this: the stylesheets construct a result tree fragment for some verbatim environment. The Verbatim class initializes a NumberLinesEmitter with information about what lines should be numbered and how. Then the result tree fragment is "replayed" through the NumberLinesEmitter; the NumberLinesEmitter builds a new result tree fragment from this event stream, decorated with line numbers, and that is returned.

Change Log:

1.0

Initial release.

See Also:
Verbatim

Constructor Summary
NumberLinesEmitter(com.icl.saxon.om.NamePool namePool, int modulus, int width, java.lang.String separator, boolean foStylesheet)
          Constructor for the NumberLinesEmitter.
 
Method Summary
 void characters(char[] chars, int start, int len)
          Process characters.
 void endElement(int nameCode)
          Process end element events.
 void startElement(int nameCode, org.xml.sax.Attributes attributes, int[] namespaces, int nscount)
          Process start element events.
 
Methods inherited from class com.nwalsh.saxon6.CopyEmitter
comment, endDocument, getResultTreeFragment, processingInstruction, setCharacterSet, setDocumentLocator, setEscaping, setNamePool, setOutputDetails, setUnparsedEntity, setWriter, startDocument
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberLinesEmitter

public NumberLinesEmitter(com.icl.saxon.om.NamePool namePool,
                          int modulus,
                          int width,
                          java.lang.String separator,
                          boolean foStylesheet)

Constructor for the NumberLinesEmitter.

Parameters:
namePool - The name pool to use for constructing elements and attributes.
modulus - The modulus to use for this listing.
width - The width to use for line numbers in this listing.
separator - The separator to use for this listing.
foStylesheet - Is this an FO stylesheet?
Method Detail

characters

public void characters(char[] chars,
                       int start,
                       int len)
                throws org.xml.sax.SAXException
Process characters.
Overrides:
characters in class CopyEmitter

endElement

public void endElement(int nameCode)
                throws org.xml.sax.SAXException
Process end element events.
Overrides:
endElement in class CopyEmitter

startElement

public void startElement(int nameCode,
                         org.xml.sax.Attributes attributes,
                         int[] namespaces,
                         int nscount)
                  throws org.xml.sax.SAXException
Process start element events.
Overrides:
startElement in class CopyEmitter