1 3 9 10 package javax.xml.parsers; 11 12 import javax.xml.validation.Schema ; 13 14 import org.xml.sax.SAXException ; 15 import org.xml.sax.SAXNotRecognizedException ; 16 import org.xml.sax.SAXNotSupportedException ; 17 18 25 public abstract class SAXParserFactory { 26 27 private static final String DEFAULT_PROPERTY_NAME = "javax.xml.parsers.SAXParserFactory"; 28 29 32 private boolean validating = false; 33 34 37 private boolean namespaceAware = false; 38 39 42 protected SAXParserFactory () { 43 44 } 45 46 104 105 public static SAXParserFactory newInstance() { 106 try { 107 return (SAXParserFactory ) FactoryFinder.find( 108 109 "javax.xml.parsers.SAXParserFactory", 110 111 "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"); 112 } catch (FactoryFinder.ConfigurationError e) { 113 throw new FactoryConfigurationError (e.getException(), 114 e.getMessage()); 115 } 116 } 117 118 128 129 public abstract SAXParser newSAXParser() 130 throws ParserConfigurationException , SAXException ; 131 132 133 141 142 public void setNamespaceAware(boolean awareness) { 143 this.namespaceAware = awareness; 144 } 145 146 171 172 public void setValidating(boolean validating) { 173 this.validating = validating; 174 } 175 176 183 184 public boolean isNamespaceAware() { 185 return namespaceAware; 186 } 187 188 195 196 public boolean isValidating() { 197 return validating; 198 } 199 200 237 public abstract void setFeature(String name, boolean value) 238 throws ParserConfigurationException , SAXNotRecognizedException , 239 SAXNotSupportedException ; 240 241 256 public abstract boolean getFeature(String name) 257 throws ParserConfigurationException , SAXNotRecognizedException , 258 SAXNotSupportedException ; 259 260 261 262 266 271 272 290 public Schema getSchema() { 291 throw new UnsupportedOperationException ( 292 "This parser does not support specification \"" 293 + this.getClass().getPackage().getSpecificationTitle() 294 + "\" version \"" 295 + this.getClass().getPackage().getSpecificationVersion() 296 + "\"" 297 ); 298 } 299 300 305 310 311 360 public void setSchema(Schema schema) { 361 throw new UnsupportedOperationException ( 362 "This parser does not support specification \"" 363 + this.getClass().getPackage().getSpecificationTitle() 364 + "\" version \"" 365 + this.getClass().getPackage().getSpecificationVersion() 366 + "\"" 367 ); 368 } 369 370 389 public void setXIncludeAware(final boolean state) { 390 throw new UnsupportedOperationException ( 391 "This parser does not support specification \"" 392 + this.getClass().getPackage().getSpecificationTitle() 393 + "\" version \"" 394 + this.getClass().getPackage().getSpecificationVersion() 395 + "\"" 396 ); 397 } 398 399 411 public boolean isXIncludeAware() { 412 throw new UnsupportedOperationException ( 413 "This parser does not support specification \"" 414 + this.getClass().getPackage().getSpecificationTitle() 415 + "\" version \"" 416 + this.getClass().getPackage().getSpecificationVersion() 417 + "\"" 418 ); 419 } 420 } 421 422 | Popular Tags |