1 16 17 package org.apache.xerces.parsers; 18 19 import org.apache.xerces.impl.Constants; 20 import org.apache.xerces.util.SymbolTable; 21 import org.apache.xerces.xni.grammars.XMLGrammarPool; 22 import org.apache.xerces.xni.parser.XMLParserConfiguration; 23 24 34 public class SAXParser 35 extends AbstractSAXParser { 36 37 41 43 44 protected static final String NOTIFY_BUILTIN_REFS = 45 Constants.XERCES_FEATURE_PREFIX + Constants.NOTIFY_BUILTIN_REFS_FEATURE; 46 47 48 private static final String [] RECOGNIZED_FEATURES = { 49 NOTIFY_BUILTIN_REFS, 50 }; 51 52 54 55 protected static final String SYMBOL_TABLE = 56 Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY; 57 58 59 protected static final String XMLGRAMMAR_POOL = 60 Constants.XERCES_PROPERTY_PREFIX+Constants.XMLGRAMMAR_POOL_PROPERTY; 61 62 63 private static final String [] RECOGNIZED_PROPERTIES = { 64 SYMBOL_TABLE, 65 XMLGRAMMAR_POOL, 66 }; 67 68 72 75 public SAXParser(XMLParserConfiguration config) { 76 super(config); 77 } 79 82 public SAXParser() { 83 this(null, null); 84 } 86 89 public SAXParser(SymbolTable symbolTable) { 90 this(symbolTable, null); 91 } 93 97 public SAXParser(SymbolTable symbolTable, XMLGrammarPool grammarPool) { 98 super((XMLParserConfiguration)ObjectFactory.createObject( 99 "org.apache.xerces.xni.parser.XMLParserConfiguration", 100 "org.apache.xerces.parsers.XIncludeAwareParserConfiguration" 101 )); 102 103 fConfiguration.addRecognizedFeatures(RECOGNIZED_FEATURES); 105 fConfiguration.setFeature(NOTIFY_BUILTIN_REFS, true); 106 107 fConfiguration.addRecognizedProperties(RECOGNIZED_PROPERTIES); 109 if (symbolTable != null) { 110 fConfiguration.setProperty(SYMBOL_TABLE, symbolTable); 111 } 112 if (grammarPool != null) { 113 fConfiguration.setProperty(XMLGRAMMAR_POOL, grammarPool); 114 } 115 116 } 118 } | Popular Tags |