| 1 |
package com.nwalsh.saxon; |
| 2 |
|
| 3 |
import org.xml.sax.*; |
| 4 |
import javax.xml.transform.TransformerException; |
| 5 |
import com.icl.saxon.output.*; |
| 6 |
import com.icl.saxon.om.*; |
| 7 |
import com.icl.saxon.expr.FragmentValue; |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
public class LineCountEmitter extends com.icl.saxon.output.Emitter { |
| 42 |
|
| 43 |
protected int numLines = 0; |
| 44 |
|
| 45 |
|
| 46 |
public LineCountEmitter() { |
| 47 |
numLines = 0; |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
public void reset() { |
| 52 |
numLines = 0; |
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
public int lineCount() { |
| 57 |
return numLines; |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
public void characters(char[] chars, int start, int len) |
| 62 |
throws javax.xml.transform.TransformerException { |
| 63 |
|
| 64 |
if (numLines == 0) { |
| 65 |
|
| 66 |
numLines++; |
| 67 |
} |
| 68 |
|
| 69 |
for (int count = start; count < start+len; count++) { |
| 70 |
if (chars[count] == '\n') { |
| 71 |
numLines++; |
| 72 |
} |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
public void comment(char[] chars, int start, int length) |
| 78 |
throws javax.xml.transform.TransformerException { |
| 79 |
|
| 80 |
} |
| 81 |
|
| 82 |
|
| 83 |
public void endDocument() |
| 84 |
throws javax.xml.transform.TransformerException { |
| 85 |
|
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
public void endElement(int nameCode) |
| 90 |
throws javax.xml.transform.TransformerException { |
| 91 |
|
| 92 |
} |
| 93 |
|
| 94 |
|
| 95 |
public void processingInstruction(java.lang.String name, |
| 96 |
java.lang.String data) |
| 97 |
throws javax.xml.transform.TransformerException { |
| 98 |
|
| 99 |
} |
| 100 |
|
| 101 |
|
| 102 |
public void setDocumentLocator(org.xml.sax.Locator locator) { |
| 103 |
|
| 104 |
} |
| 105 |
|
| 106 |
|
| 107 |
public void setEscaping(boolean escaping) |
| 108 |
throws javax.xml.transform.TransformerException { |
| 109 |
|
| 110 |
} |
| 111 |
|
| 112 |
|
| 113 |
public void setNamePool(NamePool namePool) { |
| 114 |
|
| 115 |
} |
| 116 |
|
| 117 |
|
| 118 |
public void setUnparsedEntity(java.lang.String name, java.lang.String uri) |
| 119 |
throws javax.xml.transform.TransformerException { |
| 120 |
|
| 121 |
} |
| 122 |
|
| 123 |
|
| 124 |
public void setWriter(java.io.Writer writer) { |
| 125 |
|
| 126 |
} |
| 127 |
|
| 128 |
|
| 129 |
public void startDocument() |
| 130 |
throws javax.xml.transform.TransformerException { |
| 131 |
|
| 132 |
} |
| 133 |
|
| 134 |
|
| 135 |
public void startElement(int nameCode, |
| 136 |
org.xml.sax.Attributes attributes, |
| 137 |
int[] namespaces, int nscount) |
| 138 |
throws javax.xml.transform.TransformerException { |
| 139 |
|
| 140 |
} |
| 141 |
} |