Package com.nwalsh.saxon
Class LineCountEmitter
java.lang.Object
com.icl.saxon.output.Emitter
com.nwalsh.saxon.LineCountEmitter
- All Implemented Interfaces:
Result
public class LineCountEmitter
extends com.icl.saxon.output.Emitter
Saxon extension to count the lines in a result tree fragment.
$Id: LineCountEmitter.java 5907 2006-04-27 08:26:47Z xmldoc $
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:
-
Field Summary
FieldsFields inherited from class com.icl.saxon.output.Emitter
locator, namePool, outputProperties, outputStream, systemId, writer
Fields inherited from interface javax.xml.transform.Result
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
characters
(char[] chars, int start, int len) Process characters.void
comment
(char[] chars, int start, int length) Discarded.void
Discarded.void
endElement
(int nameCode) Discarded.int
Return the number of lines.void
processingInstruction
(String name, String data) Discarded.void
reset()
Reset the number of lines.void
setDocumentLocator
(Locator locator) Discarded.void
setEscaping
(boolean escaping) Discarded.void
setNamePool
(com.icl.saxon.om.NamePool namePool) Discarded.void
setUnparsedEntity
(String name, String uri) Discarded.void
Discarded.void
Discarded.void
startElement
(int nameCode, Attributes attributes, int[] namespaces, int nscount) Discarded.Methods inherited from class com.icl.saxon.output.Emitter
getNamePool, getOutputProperties, getOutputStream, getSystemId, getWriter, makeEmitter, setOutputProperties, setOutputStream, setSystemId, usesWriter
-
Field Details
-
numLines
protected int numLinesThe number of lines seen.
-
-
Constructor Details
-
LineCountEmitter
public LineCountEmitter()Construct a new LineCountEmitter.
-
-
Method Details
-
reset
public void reset()Reset the number of lines. -
lineCount
public int lineCount()Return the number of lines. -
characters
Process characters.- Specified by:
characters
in classcom.icl.saxon.output.Emitter
- Throws:
TransformerException
-
comment
Discarded.- Specified by:
comment
in classcom.icl.saxon.output.Emitter
- Throws:
TransformerException
-
endDocument
Discarded.- Specified by:
endDocument
in classcom.icl.saxon.output.Emitter
- Throws:
TransformerException
-
endElement
Discarded.- Specified by:
endElement
in classcom.icl.saxon.output.Emitter
- Throws:
TransformerException
-
processingInstruction
Discarded.- Specified by:
processingInstruction
in classcom.icl.saxon.output.Emitter
- Throws:
TransformerException
-
setDocumentLocator
Discarded.- Overrides:
setDocumentLocator
in classcom.icl.saxon.output.Emitter
-
setEscaping
Discarded.- Overrides:
setEscaping
in classcom.icl.saxon.output.Emitter
- Throws:
TransformerException
-
setNamePool
public void setNamePool(com.icl.saxon.om.NamePool namePool) Discarded.- Overrides:
setNamePool
in classcom.icl.saxon.output.Emitter
-
setUnparsedEntity
Discarded.- Overrides:
setUnparsedEntity
in classcom.icl.saxon.output.Emitter
- Throws:
TransformerException
-
setWriter
Discarded.- Overrides:
setWriter
in classcom.icl.saxon.output.Emitter
-
startDocument
Discarded.- Specified by:
startDocument
in classcom.icl.saxon.output.Emitter
- Throws:
TransformerException
-
startElement
public void startElement(int nameCode, Attributes attributes, int[] namespaces, int nscount) throws TransformerException Discarded.- Specified by:
startElement
in classcom.icl.saxon.output.Emitter
- Throws:
TransformerException
-