Source Code Cross Referenced for LineCountEmitter.java in  » J2EE » enhydra » com » nwalsh » saxon » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » enhydra » com.nwalsh.saxon 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.nwalsh.saxon;
002:
003:        import org.xml.sax.*;
004:        import javax.xml.transform.TransformerException;
005:        import com.icl.saxon.output.*;
006:        import com.icl.saxon.om.*;
007:        import com.icl.saxon.expr.FragmentValue;
008:
009:        /**
010:         * <p>Saxon extension to count the lines in a result tree fragment.</p>
011:         *
012:         * <p>$Id: LineCountEmitter.java,v 1.4 2005-08-30 08:14:58 draganr Exp $</p>
013:         *
014:         * <p>Copyright (C) 2000 Norman Walsh.</p>
015:         *
016:         * <p>This class provides a
017:         * <a href="http://users.iclway.co.uk/mhkay/saxon/">Saxon 6.*</a>
018:         * implementation to count the number of lines in a result tree
019:         * fragment.</p>
020:         *
021:         * <p>The general design is this: the stylesheets construct a result tree
022:         * fragment for some verbatim environment. That result tree fragment
023:         * is "replayed" through the LineCountEmitter; the LineCountEmitter watches
024:         * characters go by and counts the number of line feeds that it sees.
025:         * That number is then returned.</p>
026:         *
027:         * <p><b>Change Log:</b></p>
028:         * <dl>
029:         * <dt>1.0</dt>
030:         * <dd><p>Initial release.</p></dd>
031:         * </dl>
032:         *
033:         * @see Verbatim
034:         *
035:         * @author Norman Walsh
036:         * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
037:         *
038:         * @version $Id: LineCountEmitter.java,v 1.4 2005-08-30 08:14:58 draganr Exp $
039:         *
040:         */
041:        public class LineCountEmitter extends com.icl.saxon.output.Emitter {
042:            /** The number of lines seen. */
043:            protected int numLines = 0;
044:
045:            /** Construct a new LineCountEmitter. */
046:            public LineCountEmitter() {
047:                numLines = 0;
048:            }
049:
050:            /** Reset the number of lines. */
051:            public void reset() {
052:                numLines = 0;
053:            }
054:
055:            /** Return the number of lines. */
056:            public int lineCount() {
057:                return numLines;
058:            }
059:
060:            /** Process characters. */
061:            public void characters(char[] chars, int start, int len)
062:                    throws javax.xml.transform.TransformerException {
063:
064:                if (numLines == 0) {
065:                    // If there are any characters at all, there's at least one line
066:                    numLines++;
067:                }
068:
069:                for (int count = start; count < start + len; count++) {
070:                    if (chars[count] == '\n') {
071:                        numLines++;
072:                    }
073:                }
074:            }
075:
076:            /** Discarded. */
077:            public void comment(char[] chars, int start, int length)
078:                    throws javax.xml.transform.TransformerException {
079:                // nop
080:            }
081:
082:            /** Discarded. */
083:            public void endDocument()
084:                    throws javax.xml.transform.TransformerException {
085:                // nop
086:            }
087:
088:            /** Discarded. */
089:            public void endElement(int nameCode)
090:                    throws javax.xml.transform.TransformerException {
091:                // nop
092:            }
093:
094:            /** Discarded. */
095:            public void processingInstruction(java.lang.String name,
096:                    java.lang.String data)
097:                    throws javax.xml.transform.TransformerException {
098:                // nop
099:            }
100:
101:            /** Discarded. */
102:            public void setDocumentLocator(org.xml.sax.Locator locator) {
103:                // nop
104:            }
105:
106:            /** Discarded. */
107:            public void setEscaping(boolean escaping)
108:                    throws javax.xml.transform.TransformerException {
109:                // nop
110:            }
111:
112:            /** Discarded. */
113:            public void setNamePool(NamePool namePool) {
114:                // nop
115:            }
116:
117:            /** Discarded. */
118:            public void setUnparsedEntity(java.lang.String name,
119:                    java.lang.String uri)
120:                    throws javax.xml.transform.TransformerException {
121:                // nop
122:            }
123:
124:            /** Discarded. */
125:            public void setWriter(java.io.Writer writer) {
126:                // nop
127:            }
128:
129:            /** Discarded. */
130:            public void startDocument()
131:                    throws javax.xml.transform.TransformerException {
132:                // nop
133:            }
134:
135:            /** Discarded. */
136:            public void startElement(int nameCode,
137:                    org.xml.sax.Attributes attributes, int[] namespaces,
138:                    int nscount)
139:                    throws javax.xml.transform.TransformerException {
140:                // nop
141:            }
142:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.