1 57 58 package com.sun.org.apache.xerces.internal.parsers; 59 60 import com.sun.org.apache.xerces.internal.impl.Constants; 61 import com.sun.org.apache.xerces.internal.util.SymbolTable; 62 import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool; 63 import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration; 64 65 75 public class SAXParser 76 extends AbstractSAXParser { 77 78 82 84 85 protected static final String NOTIFY_BUILTIN_REFS = 86 Constants.XERCES_FEATURE_PREFIX + Constants.NOTIFY_BUILTIN_REFS_FEATURE; 87 88 89 private static final String [] RECOGNIZED_FEATURES = { 90 NOTIFY_BUILTIN_REFS, 91 }; 92 93 95 96 protected static final String SYMBOL_TABLE = 97 Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY; 98 99 100 protected static final String XMLGRAMMAR_POOL = 101 Constants.XERCES_PROPERTY_PREFIX+Constants.XMLGRAMMAR_POOL_PROPERTY; 102 103 104 private static final String [] RECOGNIZED_PROPERTIES = { 105 SYMBOL_TABLE, 106 XMLGRAMMAR_POOL, 107 }; 108 109 113 116 public SAXParser(XMLParserConfiguration config) { 117 super(config); 118 } 120 123 public SAXParser() { 124 this(null, null); 125 } 127 130 public SAXParser(SymbolTable symbolTable) { 131 this(symbolTable, null); 132 } 134 138 public SAXParser(SymbolTable symbolTable, XMLGrammarPool grammarPool) { 139 super((XMLParserConfiguration)ObjectFactory.createObject( 140 "com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration", 141 "com.sun.org.apache.xerces.internal.parsers.XIncludeParserConfiguration" 142 )); 143 144 fConfiguration.addRecognizedFeatures(RECOGNIZED_FEATURES); 146 fConfiguration.setFeature(NOTIFY_BUILTIN_REFS, true); 147 148 fConfiguration.addRecognizedProperties(RECOGNIZED_PROPERTIES); 150 if (symbolTable != null) { 151 fConfiguration.setProperty(SYMBOL_TABLE, symbolTable); 152 } 153 if (grammarPool != null) { 154 fConfiguration.setProperty(XMLGRAMMAR_POOL, grammarPool); 155 } 156 157 } 159 } | Popular Tags |