Source Code Cross Referenced for ObjectXMLReader.java in  » Web-Services » Gomba » org » gomba » utils » xml » 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 » Web Services » Gomba » org.gomba.utils.xml 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.gomba.utils.xml;
002:
003:        import java.io.IOException;
004:
005:        import org.xml.sax.ContentHandler;
006:        import org.xml.sax.DTDHandler;
007:        import org.xml.sax.EntityResolver;
008:        import org.xml.sax.ErrorHandler;
009:        import org.xml.sax.InputSource;
010:        import org.xml.sax.SAXException;
011:        import org.xml.sax.SAXNotRecognizedException;
012:        import org.xml.sax.SAXNotSupportedException;
013:        import org.xml.sax.XMLReader;
014:
015:        /**
016:         * This class implements the SAX XMLReader interface and adds a new
017:         * <code>parse</code> method accepting an <code>ObjectInputSource</code>.
018:         * This is useful to serialize arbitrary Java objects to XML on the fly. This is
019:         * done by extending this class and overriding the <code>parse</code> method.
020:         * Once you get the referece to your custom Object by calling
021:         * <code>ObjectInputSource.getObject()</code>, you can play with the
022:         * <code>ContentHandler</code> and generate the SAX events according to your
023:         * object model.
024:         * 
025:         * @author Flavio Tordini
026:         * @version $Id: ObjectXMLReader.java,v 1.3 2004/09/16 09:23:17 flaviotordini Exp $
027:         * @see ObjectInputSource
028:         * @see <a
029:         *           href="http://java.sun.com/webservices/docs/1.1/tutorial/doc/JAXPXSLT6.html">Generating
030:         *           XML from an Arbitrary Data Structure </a>
031:         * @see <a href="http://www.saxproject.org/">The SAX Project </a>
032:         */
033:        public abstract class ObjectXMLReader implements  XMLReader {
034:
035:            protected ContentHandler handler;
036:
037:            protected ErrorHandler errorHandler;
038:
039:            protected EntityResolver resolver;
040:
041:            protected DTDHandler dtdHandler;
042:
043:            /**
044:             * @see org.xml.sax.XMLReader#getContentHandler()
045:             */
046:            public ContentHandler getContentHandler() {
047:                return this .handler;
048:            }
049:
050:            /**
051:             * @see org.xml.sax.XMLReader#getDTDHandler()
052:             */
053:            public DTDHandler getDTDHandler() {
054:                return this .dtdHandler;
055:            }
056:
057:            /**
058:             * @see org.xml.sax.XMLReader#getEntityResolver()
059:             */
060:            public EntityResolver getEntityResolver() {
061:                return this .resolver;
062:            }
063:
064:            /**
065:             * @see org.xml.sax.XMLReader#getErrorHandler()
066:             */
067:            public ErrorHandler getErrorHandler() {
068:                return this .errorHandler;
069:            }
070:
071:            /**
072:             * @see org.xml.sax.XMLReader#getFeature(java.lang.String)
073:             */
074:            public boolean getFeature(String name)
075:                    throws SAXNotRecognizedException, SAXNotSupportedException {
076:                return false;
077:            }
078:
079:            /**
080:             * @see org.xml.sax.XMLReader#getProperty(java.lang.String)
081:             */
082:            public Object getProperty(String name)
083:                    throws SAXNotRecognizedException, SAXNotSupportedException {
084:                return null;
085:            }
086:
087:            /**
088:             * @see org.xml.sax.XMLReader#parse(org.xml.sax.InputSource)
089:             */
090:            public void parse(InputSource input) throws IOException,
091:                    SAXException {
092:                if (!(input instanceof  ObjectInputSource)) {
093:                    throw new SAXException("InputSource must be of "
094:                            + ObjectInputSource.class);
095:                }
096:
097:                if (this .handler == null) {
098:                    throw new SAXException("No content handler");
099:                }
100:
101:                ObjectInputSource objectInputSource = (ObjectInputSource) input;
102:                parse(objectInputSource);
103:            }
104:
105:            public abstract void parse(ObjectInputSource input)
106:                    throws IOException, SAXException;
107:
108:            /**
109:             * @see org.xml.sax.XMLReader#parse(java.lang.String)
110:             */
111:            public void parse(String systemId) throws IOException, SAXException {
112:                throw new UnsupportedOperationException("Not implemented.");
113:            }
114:
115:            /**
116:             * @see org.xml.sax.XMLReader#setContentHandler(org.xml.sax.ContentHandler)
117:             */
118:            public void setContentHandler(ContentHandler handler) {
119:                this .handler = handler;
120:            }
121:
122:            /**
123:             * @see org.xml.sax.XMLReader#setDTDHandler(org.xml.sax.DTDHandler)
124:             */
125:            public void setDTDHandler(DTDHandler dtdHandler) {
126:                this .dtdHandler = dtdHandler;
127:            }
128:
129:            /**
130:             * @see org.xml.sax.XMLReader#setEntityResolver(org.xml.sax.EntityResolver)
131:             */
132:            public void setEntityResolver(EntityResolver resolver) {
133:                this .resolver = resolver;
134:            }
135:
136:            /**
137:             * @see org.xml.sax.XMLReader#setErrorHandler(org.xml.sax.ErrorHandler)
138:             */
139:            public void setErrorHandler(ErrorHandler errorHandler) {
140:                this .errorHandler = errorHandler;
141:            }
142:
143:            /**
144:             * @see org.xml.sax.XMLReader#setFeature(java.lang.String, boolean)
145:             */
146:            public void setFeature(String name, boolean value)
147:                    throws SAXNotRecognizedException, SAXNotSupportedException {
148:                // dummy
149:            }
150:
151:            /**
152:             * @see org.xml.sax.XMLReader#setProperty(java.lang.String,
153:             *           java.lang.Object)
154:             */
155:            public void setProperty(String name, Object value)
156:                    throws SAXNotRecognizedException, SAXNotSupportedException {
157:                // dummy
158:            }
159:
160:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.