Source Code Cross Referenced for EasyGenerationContentHandlerProxy.java in  » Graphic-Library » fop » embedding » tools » 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 » Graphic Library » fop » embedding.tools 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        /* $Id: EasyGenerationContentHandlerProxy.java 426576 2006-07-28 15:44:37Z jeremias $ */
019:
020:        package embedding.tools;
021:
022:        //SAX
023:        import org.xml.sax.ContentHandler;
024:        import org.xml.sax.Locator;
025:        import org.xml.sax.Attributes;
026:        import org.xml.sax.SAXException;
027:        import org.xml.sax.helpers.AttributesImpl;
028:
029:        /**
030:         * This class is an implementation of ContentHandler which acts as a proxy to
031:         * another ContentHandler and has the purpose to provide a few handy methods 
032:         * that make life easier when generating SAX events.
033:         * <br>
034:         * Note: This class is only useful for simple cases with no namespaces. 
035:         */
036:
037:        public class EasyGenerationContentHandlerProxy implements 
038:                ContentHandler {
039:
040:            /** An empty Attributes object used when no attributes are needed. */
041:            public static final Attributes EMPTY_ATTS = new AttributesImpl();
042:
043:            private ContentHandler target;
044:
045:            /**
046:             * Main constructor.
047:             * @param forwardTo ContentHandler to forward the SAX event to.
048:             */
049:            public EasyGenerationContentHandlerProxy(ContentHandler forwardTo) {
050:                this .target = forwardTo;
051:            }
052:
053:            /**
054:             * Sends the notification of the beginning of an element.
055:             * @param name Name for the element.
056:             * @throws SAXException Any SAX exception, possibly wrapping another exception.
057:             */
058:            public void startElement(String name) throws SAXException {
059:                startElement(name, EMPTY_ATTS);
060:            }
061:
062:            /**
063:             * Sends the notification of the beginning of an element.
064:             * @param name Name for the element.
065:             * @param atts The attributes attached to the element. If there are no 
066:             * attributes, it shall be an empty Attributes object. 
067:             * @throws SAXException Any SAX exception, possibly wrapping another exception.
068:             */
069:            public void startElement(String name, Attributes atts)
070:                    throws SAXException {
071:                startElement(null, name, name, atts);
072:            }
073:
074:            /**
075:             * Send a String of character data.
076:             * @param s The content String
077:             * @throws SAXException Any SAX exception, possibly wrapping another exception.
078:             */
079:            public void characters(String s) throws SAXException {
080:                target.characters(s.toCharArray(), 0, s.length());
081:            }
082:
083:            /**
084:             * Send the notification of the end of an element.
085:             * @param name Name for the element.
086:             * @throws SAXException Any SAX exception, possibly wrapping another exception.
087:             */
088:            public void endElement(String name) throws SAXException {
089:                endElement(null, name, name);
090:            }
091:
092:            /**
093:             * Sends notifications for a whole element with some String content.
094:             * @param name Name for the element.
095:             * @param value Content of the element.
096:             * @throws SAXException Any SAX exception, possibly wrapping another exception.
097:             */
098:            public void element(String name, String value) throws SAXException {
099:                element(name, value, EMPTY_ATTS);
100:            }
101:
102:            /**
103:             * Sends notifications for a whole element with some String content.
104:             * @param name Name for the element.
105:             * @param value Content of the element.
106:             * @param atts The attributes attached to the element. If there are no 
107:             * attributes, it shall be an empty Attributes object. 
108:             * @throws SAXException Any SAX exception, possibly wrapping another exception.
109:             */
110:            public void element(String name, String value, Attributes atts)
111:                    throws SAXException {
112:                startElement(name, atts);
113:                if (value != null) {
114:                    characters(value.toCharArray(), 0, value.length());
115:                }
116:                endElement(name);
117:            }
118:
119:            /* =========== ContentHandler interface =========== */
120:
121:            /**
122:             * @see org.xml.sax.ContentHandler#setDocumentLocator(Locator)
123:             */
124:            public void setDocumentLocator(Locator locator) {
125:                target.setDocumentLocator(locator);
126:            }
127:
128:            /**
129:             * @see org.xml.sax.ContentHandler#startDocument()
130:             */
131:            public void startDocument() throws SAXException {
132:                target.startDocument();
133:            }
134:
135:            /**
136:             * @see org.xml.sax.ContentHandler#endDocument()
137:             */
138:            public void endDocument() throws SAXException {
139:                target.endDocument();
140:            }
141:
142:            /**
143:             * @see org.xml.sax.ContentHandler#startPrefixMapping(String, String)
144:             */
145:            public void startPrefixMapping(String prefix, String uri)
146:                    throws SAXException {
147:                target.startPrefixMapping(prefix, uri);
148:            }
149:
150:            /**
151:             * @see org.xml.sax.ContentHandler#endPrefixMapping(String)
152:             */
153:            public void endPrefixMapping(String prefix) throws SAXException {
154:                target.endPrefixMapping(prefix);
155:            }
156:
157:            /**
158:             * @see org.xml.sax.ContentHandler#startElement(String, String, String, Attributes)
159:             */
160:            public void startElement(String namespaceURI, String localName,
161:                    String qName, Attributes atts) throws SAXException {
162:                target.startElement(namespaceURI, localName, qName, atts);
163:            }
164:
165:            /**
166:             * @see org.xml.sax.ContentHandler#endElement(String, String, String)
167:             */
168:            public void endElement(String namespaceURI, String localName,
169:                    String qName) throws SAXException {
170:                target.endElement(namespaceURI, localName, qName);
171:            }
172:
173:            /**
174:             * @see org.xml.sax.ContentHandler#characters(char[], int, int)
175:             */
176:            public void characters(char[] ch, int start, int length)
177:                    throws SAXException {
178:                target.characters(ch, start, length);
179:            }
180:
181:            /**
182:             * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int)
183:             */
184:            public void ignorableWhitespace(char[] ch, int start, int length)
185:                    throws SAXException {
186:                target.ignorableWhitespace(ch, start, length);
187:            }
188:
189:            /**
190:             * @see org.xml.sax.ContentHandler#processingInstruction(String, String)
191:             */
192:            public void processingInstruction(String target, String data)
193:                    throws SAXException {
194:                this .target.processingInstruction(target, data);
195:            }
196:
197:            /**
198:             * @see org.xml.sax.ContentHandler#skippedEntity(String)
199:             */
200:            public void skippedEntity(String name) throws SAXException {
201:                target.skippedEntity(name);
202:            }
203:
204:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.