|
|||||||||
| Home >> All >> com >> nwalsh >> [ saxon overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.nwalsh.saxon
Class NumberLinesEmitter

java.lang.Objectcom.icl.saxon.output.Emitter
com.nwalsh.saxon.CopyEmitter
com.nwalsh.saxon.NumberLinesEmitter
- public class NumberLinesEmitter
- extends CopyEmitter
Saxon extension to decorate a result tree fragment with line numbers.
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.
| Nested Class Summary | |
private class |
NumberLinesEmitter.StartElementInfo
A private class for maintaining the information required to call the startElement method. |
| Field Summary | |
protected java.util.Stack |
elementStack
A stack for the preserving information about open elements. |
protected boolean |
firstElement
Is the next element absolutely the first element in the fragment? |
protected boolean |
foStylesheet
Is the stylesheet currently running an FO stylesheet? |
protected static java.lang.String |
foURI
The FO namespace name. |
protected int |
lineNumber
The current line number. |
protected int |
modulus
Every modulus line will be numbered. |
protected java.lang.String |
separator
Line numbers are separated from the listing by separator. |
protected int |
width
Line numbers are width characters wide. |
| Fields inherited from class com.nwalsh.saxon.CopyEmitter |
namePool, rtf, rtfEmitter |
| Constructor Summary | |
NumberLinesEmitter(Controller controller,
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. |
protected void |
formatLineNumber(int lineNumber)
Add a formatted line number to the result tree fragment. |
protected boolean |
skipThisElement(int nameCode)
Protect the outer-most block wrapper. |
void |
startElement(int nameCode,
org.xml.sax.Attributes attributes,
int[] namespaces,
int nscount)
Process start element events. |
| Methods inherited from class com.nwalsh.saxon.CopyEmitter |
comment, endDocument, getResultTreeFragment, processingInstruction, setDocumentLocator, setEscaping, setNamePool, setUnparsedEntity, setWriter, startDocument |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
elementStack
protected java.util.Stack elementStack
- A stack for the preserving information about open elements.
lineNumber
protected int lineNumber
- The current line number.
firstElement
protected boolean firstElement
- Is the next element absolutely the first element in the fragment?
foURI
protected static java.lang.String foURI
- The FO namespace name.
modulus
protected int modulus
- Every
modulusline will be numbered.
width
protected int width
- Line numbers are
widthcharacters wide.
separator
protected java.lang.String separator
- Line numbers are separated from the listing by
separator.
foStylesheet
protected boolean foStylesheet
- Is the stylesheet currently running an FO stylesheet?
| Constructor Detail |
NumberLinesEmitter
public NumberLinesEmitter(Controller controller,
NamePool namePool,
int modulus,
int width,
java.lang.String separator,
boolean foStylesheet)
Constructor for the NumberLinesEmitter.
| Method Detail |
characters
public void characters(char[] chars,
int start,
int len)
throws javax.xml.transform.TransformerException
- Process characters.
- Overrides:
charactersin classCopyEmitter
formatLineNumber
protected void formatLineNumber(int lineNumber)
throws javax.xml.transform.TransformerException
Add a formatted line number to the result tree fragment.
endElement
public void endElement(int nameCode)
throws javax.xml.transform.TransformerException
- Process end element events.
- Overrides:
endElementin classCopyEmitter
startElement
public void startElement(int nameCode,
org.xml.sax.Attributes attributes,
int[] namespaces,
int nscount)
throws javax.xml.transform.TransformerException
- Process start element events.
- Overrides:
startElementin classCopyEmitter
skipThisElement
protected boolean skipThisElement(int nameCode)
Protect the outer-most block wrapper.
Open elements in the result tree fragment are closed and reopened around callouts (so that callouts don't appear inside links or other environments). But if the result tree fragment is a single block (a div or pre in HTML, an fo:block in FO), that outer-most block is treated specially.
This method returns true if the element in question is that outermost block.
|
|||||||||
| Home >> All >> com >> nwalsh >> [ saxon overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.icl.saxon.output.Emitter