1 57 package com.sun.org.apache.xerces.internal.parsers; 58 59 import com.sun.org.apache.xerces.internal.impl.Constants; 60 import com.sun.org.apache.xerces.internal.util.SymbolTable; 61 import com.sun.org.apache.xerces.internal.xinclude.XPointerSchema; 62 import com.sun.org.apache.xerces.internal.xinclude.XIncludeNamespaceSupport; 63 import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler; 64 import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool; 65 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager; 66 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource; 67 68 71 public class XPointerParserConfiguration extends XML11Configuration { 72 73 private XPointerSchema fXPointerSchemaComponent; 74 75 76 protected static final String XINCLUDE_HANDLER = 77 Constants.XERCES_PROPERTY_PREFIX + Constants.XINCLUDE_HANDLER_PROPERTY; 78 79 80 protected static final String NAMESPACE_CONTEXT = 81 Constants.XERCES_PROPERTY_PREFIX + Constants.NAMESPACE_CONTEXT_PROPERTY; 82 83 84 public XPointerParserConfiguration() { 85 this(null, null, null); 86 } 89 94 public XPointerParserConfiguration(SymbolTable symbolTable) { 95 this(symbolTable, null, null); 96 } 99 110 public XPointerParserConfiguration( 111 SymbolTable symbolTable, 112 XMLGrammarPool grammarPool) { 113 this(symbolTable, grammarPool, null); 114 } 116 128 public XPointerParserConfiguration( 129 SymbolTable symbolTable, 130 XMLGrammarPool grammarPool, 131 XMLComponentManager parentSettings) { 132 super(symbolTable, grammarPool, parentSettings); 133 134 final String [] recognizedProperties = 136 { XINCLUDE_HANDLER, NAMESPACE_CONTEXT }; 137 138 addRecognizedProperties(recognizedProperties); 139 setProperty(NAMESPACE_CONTEXT, new XIncludeNamespaceSupport()); 140 141 } 143 144 protected void configurePipeline() { 145 146 super.configurePipeline(); 147 if (fXPointerSchemaComponent == null) { 150 if( (fXPointerSchemaComponent = (XPointerSchema)getProperty(XINCLUDE_HANDLER)) !=null){ 151 addComponent(fXPointerSchemaComponent); 152 } 153 } 154 XMLDocumentHandler next = null; 156 if (fFeatures.get(XMLSCHEMA_VALIDATION) == Boolean.TRUE) { 157 next = fSchemaValidator.getDocumentHandler(); 160 } 161 163 if (next != null) { 164 XMLDocumentSource prev = next.getDocumentSource(); 165 if (prev != null) { 166 fXPointerSchemaComponent.setDocumentSource(prev); 167 prev.setDocumentHandler(fXPointerSchemaComponent); 168 } 169 next.setDocumentSource(fXPointerSchemaComponent); 170 fXPointerSchemaComponent.setDocumentHandler(next); 171 } 172 else { 173 next = fLastComponent.getDocumentHandler(); 174 if (next != null) { 175 fXPointerSchemaComponent.setDocumentHandler(next); 176 next.setDocumentSource(fXPointerSchemaComponent); 177 } 178 fLastComponent.setDocumentHandler(fXPointerSchemaComponent); 179 fXPointerSchemaComponent.setDocumentSource(fLastComponent); 180 181 setDocumentHandler(fXPointerSchemaComponent); 182 } 183 184 } } 186 | Popular Tags |