Source Code Cross Referenced for SAXParser.java in  » Web-Server » Rimfaxe-Web-Server » javax » xml » parsers » 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 Server » Rimfaxe Web Server » javax.xml.parsers 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: SAXParser.java,v 1.4 2001/12/05 23:16:55 db Exp $
003:         * Copyright (C) 2001 Andrew Selkirk
004:         * Copyright (C) 2001 David Brownell
005:         * 
006:         * This file is part of GNU JAXP, a library.
007:         *
008:         * GNU JAXP is free software; you can redistribute it and/or modify
009:         * it under the terms of the GNU General Public License as published by
010:         * the Free Software Foundation; either version 2 of the License, or
011:         * (at your option) any later version.
012:         * 
013:         * GNU JAXP is distributed in the hope that it will be useful,
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016:         * GNU General Public License for more details.
017:         * 
018:         * You should have received a copy of the GNU General Public License
019:         * along with this program; if not, write to the Free Software
020:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
021:         *
022:         * As a special exception, if you link this library with other files to
023:         * produce an executable, this library does not by itself cause the
024:         * resulting executable to be covered by the GNU General Public License.
025:         * This exception does not however invalidate any other reasons why the
026:         * executable file might be covered by the GNU General Public License. 
027:         */
028:
029:        package javax.xml.parsers;
030:
031:        // Imports
032:        import java.io.*;
033:        import java.net.*;
034:        import org.w3c.dom.*;
035:        import org.xml.sax.*;
036:        import org.xml.sax.helpers.*;
037:
038:        /**
039:         * Wraps a SAX2 (or SAX1) parser.
040:         *
041:         * <p>Note that parsing with methods on this interface requires use of one
042:         * of the optional SAX base classes.  It's usually preferable to use the
043:         * SAX parser APIs directly.  SAX gives much more flexibility about how
044:         * application classes are organized, and about how the document entity is
045:         * packaged for delivery to the parser.  And JAXP doesn't otherwise provide
046:         * access to the SAX2 extension handlers for lexical or declaration events.
047:         *
048:         * @author	Andrew Selkirk
049:         * @author	David Brownell
050:         * @version	1.0
051:         */
052:        public abstract class SAXParser {
053:            /** Only subclasses may use the constructor. */
054:            protected SAXParser() {
055:            }
056:
057:            //-------------------------------------------------------------
058:            // Methods ----------------------------------------------------
059:            //-------------------------------------------------------------
060:
061:            public abstract void setProperty(String id, Object value)
062:                    throws SAXNotRecognizedException, SAXNotSupportedException;
063:
064:            public abstract Object getProperty(String id)
065:                    throws SAXNotRecognizedException, SAXNotSupportedException;
066:
067:            /**
068:             * Parse using (deprecated) SAX1 style handlers,
069:             * and a byte stream (with no URI).
070:             * Avoid using this API, since relative URIs in the document need
071:             * to be resolved against the document entity's URI, and good
072:             * diagnostics also need that URI.
073:             */
074:            public void parse(InputStream stream, HandlerBase handler)
075:                    throws SAXException, IOException {
076:                parse(new InputSource(stream), handler);
077:            }
078:
079:            /**
080:             * Parse using (deprecated) SAX1 style handlers,
081:             * and a byte stream with a specified URI.
082:             */
083:            public void parse(InputStream stream, HandlerBase handler,
084:                    String systemID) throws SAXException, IOException {
085:                InputSource source;
086:
087:                // Prepare Source
088:                source = new InputSource(stream);
089:                source.setSystemId(systemID);
090:
091:                parse(source, handler);
092:
093:            }
094:
095:            /**
096:             * Parse using SAX2 style handlers,
097:             * and a byte stream (with no URI).
098:             * Avoid using this API, since relative URIs in the document need
099:             * to be resolved against the document entity's URI, and good
100:             * diagnostics also need that URI.
101:             */
102:            public void parse(InputStream stream, DefaultHandler def)
103:                    throws SAXException, IOException {
104:                parse(new InputSource(stream), def);
105:            }
106:
107:            /**
108:             * Parse using SAX2 style handlers,
109:             * and a byte stream with a specified URI.
110:             */
111:            public void parse(InputStream stream, DefaultHandler def,
112:                    String systemID) throws SAXException, IOException {
113:                InputSource source;
114:
115:                // Prepare Source
116:                source = new InputSource(stream);
117:                source.setSystemId(systemID);
118:
119:                parse(source, def);
120:
121:            }
122:
123:            /**
124:             * Parse using (deprecated) SAX1 style handlers,
125:             * and a URI for the document entity.
126:             */
127:            public void parse(String uri, HandlerBase handler)
128:                    throws SAXException, IOException {
129:                parse(new InputSource(uri), handler);
130:            }
131:
132:            /**
133:             * Parse using SAX2 style handlers,
134:             * and a URI for the document entity.
135:             */
136:            public void parse(String uri, DefaultHandler def)
137:                    throws SAXException, IOException {
138:                parse(new InputSource(uri), def);
139:            }
140:
141:            /**
142:             * Parse using (deprecated) SAX1 style handlers,
143:             * turning a file name into the document URI.
144:             */
145:            public void parse(File file, HandlerBase handler)
146:                    throws SAXException, IOException {
147:                InputSource in;
148:
149:                in = new InputSource(DocumentBuilder.fileToURL(file));
150:                parse(in, handler);
151:            }
152:
153:            /**
154:             * Parse using SAX2 style handlers,
155:             * turning a file name into the document URI.
156:             */
157:            public void parse(File file, DefaultHandler def)
158:                    throws SAXException, IOException {
159:                InputSource in;
160:
161:                in = new InputSource(DocumentBuilder.fileToURL(file));
162:                parse(in, def);
163:            }
164:
165:            /**
166:             * Parse using (deprecated) SAX1 style handlers.
167:             */
168:            public void parse(InputSource source, HandlerBase handler)
169:                    throws SAXException, IOException {
170:                Parser parser;
171:
172:                // Prepare Parser
173:                parser = getParser();
174:                parser.setDocumentHandler(handler);
175:                parser.setDTDHandler(handler);
176:                parser.setEntityResolver(handler);
177:                parser.setErrorHandler(handler);
178:
179:                // Parse
180:                parser.parse(source);
181:
182:            }
183:
184:            /**
185:             * Parse using SAX2 style handlers.
186:             */
187:            public void parse(InputSource source, DefaultHandler def)
188:                    throws SAXException, IOException {
189:                XMLReader reader;
190:
191:                // Prepare XML Reader
192:                reader = getXMLReader();
193:                reader.setContentHandler(def);
194:                reader.setDTDHandler(def);
195:                reader.setEntityResolver(def);
196:                reader.setErrorHandler(def);
197:
198:                // NOTE:  this should NOT understand the
199:                // extension handlers (lexical, decl).
200:
201:                reader.parse(source);
202:            }
203:
204:            /**
205:             * Get a (deprecated) SAX1 driver for the underlying parser.
206:             */
207:            public abstract Parser getParser() throws SAXException;
208:
209:            /**
210:             * Get a SAX2 driver for the underlying parser.
211:             */
212:            public abstract XMLReader getXMLReader() throws SAXException;
213:
214:            public abstract boolean isNamespaceAware();
215:
216:            public abstract boolean isValidating();
217:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.