Source Code Cross Referenced for ValidatingUnmarshaller.java in  » Forum » mvnforum-1.1 » com » mvnforum » jaxb » db » impl » runtime » 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 » Forum » mvnforum 1.1 » com.mvnforum.jaxb.db.impl.runtime 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //
002:        // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v1.0.5-b16-fcs 
003:        // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
004:        // Any modifications to this file will be lost upon recompilation of the source schema. 
005:        // Generated on: 2005.12.17 at 09:43:27 AM GMT+07:00 
006:        //
007:
008:        package com.mvnforum.jaxb.db.impl.runtime;
009:
010:        import javax.xml.bind.JAXBException;
011:        import javax.xml.bind.ValidationEvent;
012:
013:        import org.iso_relax.verifier.impl.ForkContentHandler;
014:        import org.xml.sax.Attributes;
015:        import org.xml.sax.SAXException;
016:        import org.xml.sax.helpers.AttributesImpl;
017:
018:        import com.sun.msv.grammar.Grammar;
019:        import com.sun.msv.verifier.Verifier;
020:        import com.sun.msv.verifier.VerifierFilter;
021:        import com.sun.msv.verifier.regexp.REDocumentDeclaration;
022:        import com.sun.xml.bind.validator.Locator;
023:
024:        /**
025:         * Filter implementation of SAXUnmarshallerHandler.
026:         * 
027:         * <p>
028:         * This component internally uses a VerifierFilter to validate
029:         * SAX events that goes through this component.
030:         * Discovered error information is just passed down to the next component.
031:         * 
032:         * <p>
033:         * This will enable the implementation to validate all sources of SAX events
034:         * in the RI - XMLReader, DOMScanner
035:         *
036:         * SAX events will go the VerifierFilter and then to the SAXUnmarshaller...
037:         *
038:         */
039:        public class ValidatingUnmarshaller extends ForkContentHandler
040:                implements  SAXUnmarshallerHandler {
041:
042:            /**
043:             * Creates a new instance of ValidatingUnmarshaller.
044:             */
045:            public static ValidatingUnmarshaller create(Grammar grammar,
046:                    SAXUnmarshallerHandler _core, Locator locator) {
047:
048:                // create a VerifierFilter and configure it
049:                // so that error messages will be sent to the core,
050:                Verifier v = new Verifier(new REDocumentDeclaration(grammar),
051:                        new ErrorHandlerAdaptor(_core, locator));
052:                v.setPanicMode(true);
053:
054:                return new ValidatingUnmarshaller(new VerifierFilter(v), _core);
055:            }
056:
057:            private ValidatingUnmarshaller(VerifierFilter filter,
058:                    SAXUnmarshallerHandler _core) {
059:
060:                super (filter, _core);
061:                this .core = _core;
062:            }
063:
064:            // delegate to the next component
065:            public Object getResult() throws JAXBException,
066:                    IllegalStateException {
067:                return core.getResult();
068:            }
069:
070:            public void handleEvent(ValidationEvent event, boolean canRecover)
071:                    throws SAXException {
072:                // SAXUnmarshallerHandler already checks for RuntimeExceptions, so 
073:                // there is no need to wrap this call in a try/catch
074:                core.handleEvent(event, canRecover);
075:            }
076:
077:            private final SAXUnmarshallerHandler core;
078:
079:            private final AttributesImpl xsiLessAtts = new AttributesImpl();
080:
081:            public void startElement(String nsUri, String local, String qname,
082:                    Attributes atts) throws SAXException {
083:                // create an attributes set for MSV that doesn't contains xsi:schemaLocation
084:                xsiLessAtts.clear();
085:                int len = atts.getLength();
086:                for (int i = 0; i < len; i++) {
087:                    String aUri = atts.getURI(i);
088:                    String aLocal = atts.getLocalName(i);
089:                    if (aUri
090:                            .equals("http://www.w3.org/2001/XMLSchema-instance")
091:                            && (aLocal.equals("schemaLocation") || aLocal
092:                                    .equals("noNamespaceSchemaLocation") //||
093:                            /*aLocal.equals("type")*/))
094:                        continue;
095:
096:                    // we do handle xsi:nil.
097:                    xsiLessAtts.addAttribute(aUri, aLocal, atts.getQName(i),
098:                            atts.getType(i), atts.getValue(i));
099:                }
100:
101:                super.startElement(nsUri, local, qname, xsiLessAtts);
102:            }
103:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.