Source Code Cross Referenced for DOMParser.java in  » J2EE » Sofia » com » salmonllc » 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 » J2EE » Sofia » com.salmonllc.xml 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.salmonllc.xml;
002:
003:        /////////////////////////
004:        //$Archive: /JADE/SourceCode/com/salmonllc/xml/DOMParser.java $
005:        //$Author: Srufle $ 
006:        //$Revision: 10 $ 
007:        //$Modtime: 7/31/02 6:11p $ 
008:        /////////////////////////
009:        /*
010:         * (C) Copyright IBM Corp. 1999  All rights reserved.
011:         *
012:         * US Government Users Restricted Rights Use, duplication or
013:         * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
014:         *
015:         * The program is provided "as is" without any warranty express or
016:         * implied, including the warranty of non-infringement and the implied
017:         * warranties of merchantibility and fitness for a particular purpose.
018:         * IBM will not be liable for any damages suffered by you as a result
019:         * of using the Program. In no event will IBM be liable for any
020:         * special, indirect or consequential damages or lost profits even if
021:         * IBM has been advised of the possibility of their occurrence. IBM
022:         * will not be liable for any third party claims against you.
023:         */
024:
025:        import org.w3c.dom.Document;
026:
027:        import org.xml.sax.ErrorHandler;
028:        import org.xml.sax.SAXException;
029:        import org.xml.sax.SAXParseException;
030:
031:        import javax.xml.parsers.DocumentBuilderFactory;
032:        import javax.xml.parsers.DocumentBuilder;
033:
034:        /**
035:         * Licensed Material - Property of Salmon LLC
036:         * (C) Copyright Salmon LLC. 1999 - All Rights Reserved
037:         * For more information go to www.salmonllc.com
038:         *
039:         * *************************************************************************
040:         * DISCLAIMER:
041:         * The following code has been created by Salmon LLC. The code is provided
042:         * 'AS IS' , without warranty of any kind unless covered in another agreement
043:         * between your corporation and Salmon LLC.  Salmon LLC shall not be liable
044:         * for any damages arising out of your use of this, even if they have been
045:         * advised of the possibility of such damages.
046:         * *************************************************************************
047:         *
048:         * Wraps the JAXP DOM parser.
049:         *
050:         * @version Revision: 12 1.2 samples/dom/wrappers/DOMParser.java, samples, xml4j2, xml4j2_0_15
051:         */
052:        public class DOMParser implements  DOMParserWrapper, ErrorHandler {
053:
054:            //
055:            // Data
056:            //
057:            private boolean _bErrorFlagSet = false;
058:            private boolean _bWarningFlagSet = false;
059:
060:            //
061:            // Constructors
062:            //
063:
064:            /** Error. */
065:            public void error(SAXParseException ex) {
066:                System.err.println("[Error] " + getLocationString(ex) + ": "
067:                        + ex.getMessage());
068:                _bErrorFlagSet = true;
069:            }
070:
071:            /** Fatal error. */
072:            public void fatalError(SAXParseException ex) throws SAXException {
073:                System.err.println("[Fatal Error] " + getLocationString(ex)
074:                        + ": " + ex.getMessage());
075:                throw ex;
076:            }
077:
078:            //
079:            // Private methods
080:            //
081:
082:            /** Returns a string of the location. */
083:            private String getLocationString(SAXParseException ex) {
084:                StringBuffer str = new StringBuffer();
085:
086:                String systemId = ex.getSystemId();
087:                if (systemId != null) {
088:                    int index = systemId.lastIndexOf('/');
089:                    if (index != -1)
090:                        systemId = systemId.substring(index + 1);
091:                    str.append(systemId);
092:                }
093:                str.append(':');
094:                str.append(ex.getLineNumber());
095:                str.append(':');
096:                str.append(ex.getColumnNumber());
097:
098:                return str.toString();
099:
100:            } // getLocationString(SAXParseException):String
101:
102:            /**
103:             * Creation date: (3/22/02 1:52:00 PM)
104:             * @return boolean
105:             */
106:            public boolean isErrorFlagSet() {
107:                return _bErrorFlagSet;
108:            }
109:
110:            /**
111:             * Creation date: (3/22/02 1:52:00 PM)
112:             * @return boolean
113:             */
114:            public boolean isWarningFlagSet() {
115:                return _bWarningFlagSet;
116:            }
117:
118:            //
119:            // DOMParserWrapper methods
120:            //
121:
122:            /** Parses the specified URI and returns the document. */
123:            public Document parse(String uri) throws Exception {
124:                DocumentBuilderFactory dbf = DocumentBuilderFactory
125:                        .newInstance();
126:                DocumentBuilder db = dbf.newDocumentBuilder();
127:                db.setErrorHandler(this );
128:                return db.parse(uri);
129:
130:            } // parse(String):Document
131:
132:            /**
133:             * Creation date: (3/22/02 1:52:00 PM)
134:             * @param newErrorFlagSet boolean
135:             */
136:            public void setErrorFlag(boolean newErrorFlagSet) {
137:                _bErrorFlagSet = newErrorFlagSet;
138:            }
139:
140:            /**
141:             * Creation date: (3/22/02 1:52:00 PM)
142:             * @param newWarningFlagSet boolean
143:             */
144:            public void setWarningFlag(boolean newWarningFlagSet) {
145:                _bWarningFlagSet = newWarningFlagSet;
146:            }
147:
148:            //
149:            // ErrorHandler methods
150:            //
151:
152:            /** Warning. */
153:            public void warning(SAXParseException ex) {
154:                System.err.println("[Warning] " + getLocationString(ex) + ": "
155:                        + ex.getMessage());
156:                _bWarningFlagSet = true;
157:            }
158:        } // interface DOMParser
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.