Source Code Cross Referenced for SAXParseException.java in  » Development » Javolution » org » xml » sax » 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 » Development » Javolution » org.xml.sax 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // SAX exception class.
002:        // http://www.saxproject.org
003:        // No warranty; no copyright -- use this as you will.
004:
005:        package org.xml.sax;
006:
007:        /**
008:         * Encapsulate an XML parse error or warning.
009:         *
010:         * <blockquote>
011:         * <em>This module, both source code and documentation, is in the
012:         * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
013:         * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
014:         * for further information.
015:         * </blockquote>
016:         *
017:         * <p>This exception may include information for locating the error
018:         * in the original XML document, as if it came from a {@link Locator}
019:         * object.  Note that although the application
020:         * will receive a SAXParseException as the argument to the handlers
021:         * in the {@link org.xml.sax.ErrorHandler ErrorHandler} interface, 
022:         * the application is not actually required to throw the exception; 
023:         * instead, it can simply read the information in it and take a 
024:         * different action.</p>
025:         *
026:         * <p>Since this exception is a subclass of {@link org.xml.sax.SAXException 
027:         * SAXException}, it inherits the ability to wrap another exception.</p>
028:         *
029:         * @since SAX 1.0
030:         * @author David Megginson
031:         * @version 2.0.1 (sax2r2)
032:         * @see org.xml.sax.SAXException
033:         * @see org.xml.sax.Locator
034:         * @see org.xml.sax.ErrorHandler
035:         */
036:        public class SAXParseException extends SAXException {
037:
038:            //////////////////////////////////////////////////////////////////////
039:            // Constructors.
040:            //////////////////////////////////////////////////////////////////////
041:
042:            /**
043:             * Create a new SAXParseException from a message and a Locator.
044:             *
045:             * <p>This constructor is especially useful when an application is
046:             * creating its own exception from within a {@link org.xml.sax.ContentHandler
047:             * ContentHandler} callback.</p>
048:             *
049:             * @param message The error or warning message.
050:             * @param locator The locator object for the error or warning (may be
051:             *        null).
052:             * @see org.xml.sax.Locator
053:             */
054:            public SAXParseException(String message, Locator locator) {
055:                super (message);
056:                if (locator != null) {
057:                    init(locator.getPublicId(), locator.getSystemId(), locator
058:                            .getLineNumber(), locator.getColumnNumber());
059:                } else {
060:                    init(null, null, -1, -1);
061:                }
062:            }
063:
064:            /**
065:             * Wrap an existing exception in a SAXParseException.
066:             *
067:             * <p>This constructor is especially useful when an application is
068:             * creating its own exception from within a {@link org.xml.sax.ContentHandler
069:             * ContentHandler} callback, and needs to wrap an existing exception that is not a
070:             * subclass of {@link org.xml.sax.SAXException SAXException}.</p>
071:             *
072:             * @param message The error or warning message, or null to
073:             *                use the message from the embedded exception.
074:             * @param locator The locator object for the error or warning (may be
075:             *        null).
076:             * @param e Any exception.
077:             * @see org.xml.sax.Locator
078:             */
079:            public SAXParseException(String message, Locator locator,
080:                    Exception e) {
081:                super (message, e);
082:                if (locator != null) {
083:                    init(locator.getPublicId(), locator.getSystemId(), locator
084:                            .getLineNumber(), locator.getColumnNumber());
085:                } else {
086:                    init(null, null, -1, -1);
087:                }
088:            }
089:
090:            /**
091:             * Create a new SAXParseException.
092:             *
093:             * <p>This constructor is most useful for parser writers.</p>
094:             *
095:             * <p>All parameters except the message are as if
096:             * they were provided by a {@link Locator}.  For example, if the
097:             * system identifier is a URL (including relative filename), the
098:             * caller must resolve it fully before creating the exception.</p>
099:             *
100:             *
101:             * @param message The error or warning message.
102:             * @param publicId The public identifier of the entity that generated
103:             *                 the error or warning.
104:             * @param systemId The system identifier of the entity that generated
105:             *                 the error or warning.
106:             * @param lineNumber The line number of the end of the text that
107:             *                   caused the error or warning.
108:             * @param columnNumber The column number of the end of the text that
109:             *                     cause the error or warning.
110:             */
111:            public SAXParseException(String message, String publicId,
112:                    String systemId, int lineNumber, int columnNumber) {
113:                super (message);
114:                init(publicId, systemId, lineNumber, columnNumber);
115:            }
116:
117:            /**
118:             * Create a new SAXParseException with an embedded exception.
119:             *
120:             * <p>This constructor is most useful for parser writers who
121:             * need to wrap an exception that is not a subclass of
122:             * {@link org.xml.sax.SAXException SAXException}.</p>
123:             *
124:             * <p>All parameters except the message and exception are as if
125:             * they were provided by a {@link Locator}.  For example, if the
126:             * system identifier is a URL (including relative filename), the
127:             * caller must resolve it fully before creating the exception.</p>
128:             *
129:             * @param message The error or warning message, or null to use
130:             *                the message from the embedded exception.
131:             * @param publicId The public identifier of the entity that generated
132:             *                 the error or warning.
133:             * @param systemId The system identifier of the entity that generated
134:             *                 the error or warning.
135:             * @param lineNumber The line number of the end of the text that
136:             *                   caused the error or warning.
137:             * @param columnNumber The column number of the end of the text that
138:             *                     cause the error or warning.
139:             * @param e Another exception to embed in this one.
140:             */
141:            public SAXParseException(String message, String publicId,
142:                    String systemId, int lineNumber, int columnNumber,
143:                    Exception e) {
144:                super (message, e);
145:                init(publicId, systemId, lineNumber, columnNumber);
146:            }
147:
148:            /**
149:             * Internal initialization method.
150:             *
151:             * @param publicId The public identifier of the entity which generated the exception,
152:             *        or null.
153:             * @param systemId The system identifier of the entity which generated the exception,
154:             *        or null.
155:             * @param lineNumber The line number of the error, or -1.
156:             * @param columnNumber The column number of the error, or -1.
157:             */
158:            private void init(String publicId, String systemId, int lineNumber,
159:                    int columnNumber) {
160:                this .publicId = publicId;
161:                this .systemId = systemId;
162:                this .lineNumber = lineNumber;
163:                this .columnNumber = columnNumber;
164:            }
165:
166:            /**
167:             * Get the public identifier of the entity where the exception occurred.
168:             *
169:             * @return A string containing the public identifier, or null
170:             *         if none is available.
171:             * @see org.xml.sax.Locator#getPublicId
172:             */
173:            public String getPublicId() {
174:                return this .publicId;
175:            }
176:
177:            /**
178:             * Get the system identifier of the entity where the exception occurred.
179:             *
180:             * <p>If the system identifier is a URL, it will have been resolved
181:             * fully.</p>
182:             *
183:             * @return A string containing the system identifier, or null
184:             *         if none is available.
185:             * @see org.xml.sax.Locator#getSystemId
186:             */
187:            public String getSystemId() {
188:                return this .systemId;
189:            }
190:
191:            /**
192:             * The line number of the end of the text where the exception occurred.
193:             *
194:             * <p>The first line is line 1.</p>
195:             *
196:             * @return An integer representing the line number, or -1
197:             *         if none is available.
198:             * @see org.xml.sax.Locator#getLineNumber
199:             */
200:            public int getLineNumber() {
201:                return this .lineNumber;
202:            }
203:
204:            /**
205:             * The column number of the end of the text where the exception occurred.
206:             *
207:             * <p>The first column in a line is position 1.</p>
208:             *
209:             * @return An integer representing the column number, or -1
210:             *         if none is available.
211:             * @see org.xml.sax.Locator#getColumnNumber
212:             */
213:            public int getColumnNumber() {
214:                return this .columnNumber;
215:            }
216:
217:            //////////////////////////////////////////////////////////////////////
218:            // Internal state.
219:            //////////////////////////////////////////////////////////////////////
220:
221:            /**
222:             * @serial The public identifier, or null.
223:             * @see #getPublicId
224:             */
225:            private String publicId;
226:
227:            /**
228:             * @serial The system identifier, or null.
229:             * @see #getSystemId
230:             */
231:            private String systemId;
232:
233:            /**
234:             * @serial The line number, or -1.
235:             * @see #getLineNumber
236:             */
237:            private int lineNumber;
238:
239:            /**
240:             * @serial The column number, or -1.
241:             * @see #getColumnNumber
242:             */
243:            private int columnNumber;
244:
245:        }
246:
247:        // end of SAXParseException.java
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.