Source Code Cross Referenced for XIncludeParserConfiguration.java in  » XML » xerces-2_9_1 » org » apache » xerces » 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 » XML » xerces 2_9_1 » org.apache.xerces.parsers 
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:        package org.apache.xerces.parsers;
018:
019:        import org.apache.xerces.impl.Constants;
020:        import org.apache.xerces.util.SymbolTable;
021:        import org.apache.xerces.xinclude.XIncludeHandler;
022:        import org.apache.xerces.xinclude.XIncludeNamespaceSupport;
023:        import org.apache.xerces.xni.XMLDocumentHandler;
024:        import org.apache.xerces.xni.grammars.XMLGrammarPool;
025:        import org.apache.xerces.xni.parser.XMLComponentManager;
026:        import org.apache.xerces.xni.parser.XMLConfigurationException;
027:        import org.apache.xerces.xni.parser.XMLDocumentSource;
028:
029:        /**
030:         * This parser configuration includes an <code>XIncludeHandler</code> in the pipeline
031:         * before the schema validator, or as the last component in the pipeline if there is
032:         * no schema validator.  Using this pipeline will enable processing according to the
033:         * XML Inclusions specification, to the conformance level described in
034:         * <code>XIncludeHandler</code>.
035:         * 
036:         * @author Peter McCracken, IBM
037:         * @see org.apache.xerces.xinclude.XIncludeHandler
038:         */
039:        public class XIncludeParserConfiguration extends XML11Configuration {
040:
041:            private XIncludeHandler fXIncludeHandler;
042:
043:            /** Feature identifier: allow notation and unparsed entity events to be sent out of order. */
044:            protected static final String ALLOW_UE_AND_NOTATION_EVENTS = Constants.SAX_FEATURE_PREFIX
045:                    + Constants.ALLOW_DTD_EVENTS_AFTER_ENDDTD_FEATURE;
046:
047:            /** Feature identifier: fixup base URIs. */
048:            protected static final String XINCLUDE_FIXUP_BASE_URIS = Constants.XERCES_FEATURE_PREFIX
049:                    + Constants.XINCLUDE_FIXUP_BASE_URIS_FEATURE;
050:
051:            /** Feature identifier: fixup language. */
052:            protected static final String XINCLUDE_FIXUP_LANGUAGE = Constants.XERCES_FEATURE_PREFIX
053:                    + Constants.XINCLUDE_FIXUP_LANGUAGE_FEATURE;
054:
055:            /** Property identifier: error reporter. */
056:            protected static final String XINCLUDE_HANDLER = Constants.XERCES_PROPERTY_PREFIX
057:                    + Constants.XINCLUDE_HANDLER_PROPERTY;
058:
059:            /** Property identifier: error reporter. */
060:            protected static final String NAMESPACE_CONTEXT = Constants.XERCES_PROPERTY_PREFIX
061:                    + Constants.NAMESPACE_CONTEXT_PROPERTY;
062:
063:            /** Default constructor. */
064:            public XIncludeParserConfiguration() {
065:                this (null, null, null);
066:            } // <init>()
067:
068:            /** 
069:             * Constructs a parser configuration using the specified symbol table. 
070:             *
071:             * @param symbolTable The symbol table to use.
072:             */
073:            public XIncludeParserConfiguration(SymbolTable symbolTable) {
074:                this (symbolTable, null, null);
075:            } // <init>(SymbolTable)
076:
077:            /**
078:             * Constructs a parser configuration using the specified symbol table and
079:             * grammar pool.
080:             * <p>
081:             *
082:             * @param symbolTable The symbol table to use.
083:             * @param grammarPool The grammar pool to use.
084:             */
085:            public XIncludeParserConfiguration(SymbolTable symbolTable,
086:                    XMLGrammarPool grammarPool) {
087:                this (symbolTable, grammarPool, null);
088:            } // <init>(SymbolTable,XMLGrammarPool)
089:
090:            /**
091:             * Constructs a parser configuration using the specified symbol table,
092:             * grammar pool, and parent settings.
093:             * <p>
094:             *
095:             * @param symbolTable    The symbol table to use.
096:             * @param grammarPool    The grammar pool to use.
097:             * @param parentSettings The parent settings.
098:             */
099:            public XIncludeParserConfiguration(SymbolTable symbolTable,
100:                    XMLGrammarPool grammarPool,
101:                    XMLComponentManager parentSettings) {
102:                super (symbolTable, grammarPool, parentSettings);
103:
104:                fXIncludeHandler = new XIncludeHandler();
105:                addCommonComponent(fXIncludeHandler);
106:
107:                final String[] recognizedFeatures = {
108:                        ALLOW_UE_AND_NOTATION_EVENTS, XINCLUDE_FIXUP_BASE_URIS,
109:                        XINCLUDE_FIXUP_LANGUAGE };
110:                addRecognizedFeatures(recognizedFeatures);
111:
112:                // add default recognized properties
113:                final String[] recognizedProperties = { XINCLUDE_HANDLER,
114:                        NAMESPACE_CONTEXT };
115:                addRecognizedProperties(recognizedProperties);
116:
117:                setFeature(ALLOW_UE_AND_NOTATION_EVENTS, true);
118:                setFeature(XINCLUDE_FIXUP_BASE_URIS, true);
119:                setFeature(XINCLUDE_FIXUP_LANGUAGE, true);
120:
121:                setProperty(XINCLUDE_HANDLER, fXIncludeHandler);
122:                setProperty(NAMESPACE_CONTEXT, new XIncludeNamespaceSupport());
123:            } // <init>(SymbolTable,XMLGrammarPool)}
124:
125:            /** Configures the pipeline. */
126:            protected void configurePipeline() {
127:                super .configurePipeline();
128:
129:                //configure DTD pipeline
130:                fDTDScanner.setDTDHandler(fDTDProcessor);
131:                fDTDProcessor.setDTDSource(fDTDScanner);
132:                fDTDProcessor.setDTDHandler(fXIncludeHandler);
133:                fXIncludeHandler.setDTDSource(fDTDProcessor);
134:                fXIncludeHandler.setDTDHandler(fDTDHandler);
135:                if (fDTDHandler != null) {
136:                    fDTDHandler.setDTDSource(fXIncludeHandler);
137:                }
138:
139:                // configure XML document pipeline: insert after DTDValidator and 
140:                // before XML Schema validator
141:                XMLDocumentSource prev = null;
142:                if (fFeatures.get(XMLSCHEMA_VALIDATION) == Boolean.TRUE) {
143:                    // we don't have to worry about fSchemaValidator being null, since
144:                    // super.configurePipeline() instantiated it if the feature was set
145:                    prev = fSchemaValidator.getDocumentSource();
146:                }
147:                // Otherwise, insert after the last component in the pipeline
148:                else {
149:                    prev = fLastComponent;
150:                    fLastComponent = fXIncludeHandler;
151:                }
152:
153:                XMLDocumentHandler next = prev.getDocumentHandler();
154:                prev.setDocumentHandler(fXIncludeHandler);
155:                fXIncludeHandler.setDocumentSource(prev);
156:                if (next != null) {
157:                    fXIncludeHandler.setDocumentHandler(next);
158:                    next.setDocumentSource(fXIncludeHandler);
159:                }
160:
161:            } // configurePipeline()
162:
163:            protected void configureXML11Pipeline() {
164:                super .configureXML11Pipeline();
165:
166:                // configure XML 1.1. DTD pipeline
167:                fXML11DTDScanner.setDTDHandler(fXML11DTDProcessor);
168:                fXML11DTDProcessor.setDTDSource(fXML11DTDScanner);
169:                fXML11DTDProcessor.setDTDHandler(fXIncludeHandler);
170:                fXIncludeHandler.setDTDSource(fXML11DTDProcessor);
171:                fXIncludeHandler.setDTDHandler(fDTDHandler);
172:                if (fDTDHandler != null) {
173:                    fDTDHandler.setDTDSource(fXIncludeHandler);
174:                }
175:
176:                // configure XML document pipeline: insert after DTDValidator and 
177:                // before XML Schema validator
178:                XMLDocumentSource prev = null;
179:                if (fFeatures.get(XMLSCHEMA_VALIDATION) == Boolean.TRUE) {
180:                    // we don't have to worry about fSchemaValidator being null, since
181:                    // super.configurePipeline() instantiated it if the feature was set
182:                    prev = fSchemaValidator.getDocumentSource();
183:                }
184:                // Otherwise, insert after the last component in the pipeline
185:                else {
186:                    prev = fLastComponent;
187:                    fLastComponent = fXIncludeHandler;
188:                }
189:
190:                XMLDocumentHandler next = prev.getDocumentHandler();
191:                prev.setDocumentHandler(fXIncludeHandler);
192:                fXIncludeHandler.setDocumentSource(prev);
193:                if (next != null) {
194:                    fXIncludeHandler.setDocumentHandler(next);
195:                    next.setDocumentSource(fXIncludeHandler);
196:                }
197:
198:            } // configureXML11Pipeline()
199:
200:            public void setProperty(String propertyId, Object value)
201:                    throws XMLConfigurationException {
202:
203:                if (propertyId.equals(XINCLUDE_HANDLER)) {
204:                }
205:
206:                super .setProperty(propertyId, value);
207:            } // setProperty(String,Object)
208:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.