Source Code Cross Referenced for SchemaValidatorConfiguration.java in  » XML » xerces-2_9_1 » org » apache » xerces » jaxp » 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 » XML » xerces 2_9_1 » org.apache.xerces.jaxp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        package org.apache.xerces.jaxp;
019:
020:        import org.apache.xerces.impl.Constants;
021:        import org.apache.xerces.impl.XMLErrorReporter;
022:        import org.apache.xerces.impl.validation.ValidationManager;
023:        import org.apache.xerces.impl.xs.XSMessageFormatter;
024:        import org.apache.xerces.jaxp.validation.XSGrammarPoolContainer;
025:        import org.apache.xerces.xni.grammars.XMLGrammarPool;
026:        import org.apache.xerces.xni.parser.XMLComponentManager;
027:        import org.apache.xerces.xni.parser.XMLConfigurationException;
028:
029:        /**
030:         * <p>Parser configuration for Xerces' XMLSchemaValidator.</p>
031:         * 
032:         * @version $Id: SchemaValidatorConfiguration.java 447237 2006-09-18 05:03:10Z mrglavas $
033:         */
034:        final class SchemaValidatorConfiguration implements  XMLComponentManager {
035:
036:            // feature identifiers
037:
038:            /** Feature identifier: schema validation. */
039:            private static final String SCHEMA_VALIDATION = Constants.XERCES_FEATURE_PREFIX
040:                    + Constants.SCHEMA_VALIDATION_FEATURE;
041:
042:            /** Feature identifier: validation. */
043:            private static final String VALIDATION = Constants.SAX_FEATURE_PREFIX
044:                    + Constants.VALIDATION_FEATURE;
045:
046:            /** Feature identifier: use grammar pool only. */
047:            private static final String USE_GRAMMAR_POOL_ONLY = Constants.XERCES_FEATURE_PREFIX
048:                    + Constants.USE_GRAMMAR_POOL_ONLY_FEATURE;
049:
050:            /** Feature identifier: parser settings. */
051:            private static final String PARSER_SETTINGS = Constants.XERCES_FEATURE_PREFIX
052:                    + Constants.PARSER_SETTINGS;
053:
054:            // property identifiers
055:
056:            /** Property identifier: error reporter. */
057:            private static final String ERROR_REPORTER = Constants.XERCES_PROPERTY_PREFIX
058:                    + Constants.ERROR_REPORTER_PROPERTY;
059:
060:            /** Property identifier: validation manager. */
061:            private static final String VALIDATION_MANAGER = Constants.XERCES_PROPERTY_PREFIX
062:                    + Constants.VALIDATION_MANAGER_PROPERTY;
063:
064:            /** Property identifier: grammar pool. */
065:            private static final String XMLGRAMMAR_POOL = Constants.XERCES_PROPERTY_PREFIX
066:                    + Constants.XMLGRAMMAR_POOL_PROPERTY;
067:
068:            //
069:            // Data
070:            //
071:
072:            /** Parent component manager. **/
073:            private final XMLComponentManager fParentComponentManager;
074:
075:            /** The Schema's grammar pool. **/
076:            private final XMLGrammarPool fGrammarPool;
077:
078:            /** 
079:             * Tracks whether the validator should use components from 
080:             * the grammar pool to the exclusion of all others.
081:             */
082:            private final boolean fUseGrammarPoolOnly;
083:
084:            /** Validation manager. */
085:            private final ValidationManager fValidationManager;
086:
087:            public SchemaValidatorConfiguration(
088:                    XMLComponentManager parentManager,
089:                    XSGrammarPoolContainer grammarContainer,
090:                    ValidationManager validationManager) {
091:                fParentComponentManager = parentManager;
092:                fGrammarPool = grammarContainer.getGrammarPool();
093:                fUseGrammarPoolOnly = grammarContainer.isFullyComposed();
094:                fValidationManager = validationManager;
095:                // add schema message formatter to error reporter
096:                try {
097:                    XMLErrorReporter errorReporter = (XMLErrorReporter) fParentComponentManager
098:                            .getProperty(ERROR_REPORTER);
099:                    if (errorReporter != null) {
100:                        errorReporter.putMessageFormatter(
101:                                XSMessageFormatter.SCHEMA_DOMAIN,
102:                                new XSMessageFormatter());
103:                    }
104:                }
105:                // Ignore exception.
106:                catch (XMLConfigurationException exc) {
107:                }
108:            }
109:
110:            /**
111:             * Returns the state of a feature.
112:             * 
113:             * @param featureId The feature identifier.
114:             * @return true if the feature is supported
115:             * 
116:             * @throws XMLConfigurationException Thrown for configuration error.
117:             *                                   In general, components should
118:             *                                   only throw this exception if
119:             *                                   it is <strong>really</strong>
120:             *                                   a critical error.
121:             */
122:            public boolean getFeature(String featureId)
123:                    throws XMLConfigurationException {
124:                if (PARSER_SETTINGS.equals(featureId)) {
125:                    return fParentComponentManager.getFeature(featureId);
126:                } else if (VALIDATION.equals(featureId)
127:                        || SCHEMA_VALIDATION.equals(featureId)) {
128:                    return true;
129:                } else if (USE_GRAMMAR_POOL_ONLY.equals(featureId)) {
130:                    return fUseGrammarPoolOnly;
131:                }
132:                return fParentComponentManager.getFeature(featureId);
133:            }
134:
135:            /**
136:             * Returns the value of a property.
137:             * 
138:             * @param propertyId The property identifier.
139:             * @return the value of the property
140:             * 
141:             * @throws XMLConfigurationException Thrown for configuration error.
142:             *                                   In general, components should
143:             *                                   only throw this exception if
144:             *                                   it is <strong>really</strong>
145:             *                                   a critical error.
146:             */
147:            public Object getProperty(String propertyId)
148:                    throws XMLConfigurationException {
149:                if (XMLGRAMMAR_POOL.equals(propertyId)) {
150:                    return fGrammarPool;
151:                } else if (VALIDATION_MANAGER.equals(propertyId)) {
152:                    return fValidationManager;
153:                }
154:                return fParentComponentManager.getProperty(propertyId);
155:            }
156:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.