1 3 9 10 package javax.xml.parsers; 11 12 import javax.xml.validation.Schema ; 13 14 21 22 public abstract class DocumentBuilderFactory { 23 24 25 private static final String DEFAULT_PROPERTY_NAME = "javax.xml.parsers.DocumentBuilderFactory"; 26 27 private boolean validating = false; 28 private boolean namespaceAware = false; 29 private boolean whitespace = false; 30 private boolean expandEntityRef = true; 31 private boolean ignoreComments = false; 32 private boolean coalescing = false; 33 34 private boolean canonicalState = false; 35 36 protected DocumentBuilderFactory () { 37 } 38 39 96 public static DocumentBuilderFactory newInstance() { 97 try { 98 return (DocumentBuilderFactory ) FactoryFinder.find( 99 100 "javax.xml.parsers.DocumentBuilderFactory", 101 102 "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"); 103 } catch (FactoryFinder.ConfigurationError e) { 104 throw new FactoryConfigurationError (e.getException(), 105 e.getMessage()); 106 } 107 108 } 109 110 118 119 public abstract DocumentBuilder newDocumentBuilder() 120 throws ParserConfigurationException ; 121 122 123 131 132 public void setNamespaceAware(boolean awareness) { 133 this.namespaceAware = awareness; 134 } 135 136 161 162 public void setValidating(boolean validating) { 163 this.validating = validating; 164 } 165 166 180 181 public void setIgnoringElementContentWhitespace(boolean whitespace) { 182 this.whitespace = whitespace; 183 } 184 185 193 194 public void setExpandEntityReferences(boolean expandEntityRef) { 195 this.expandEntityRef = expandEntityRef; 196 } 197 198 205 206 public void setIgnoringComments(boolean ignoreComments) { 207 this.ignoreComments = ignoreComments; 208 } 209 210 220 221 public void setCoalescing(boolean coalescing) { 222 this.coalescing = coalescing; 223 } 224 225 232 233 public boolean isNamespaceAware() { 234 return namespaceAware; 235 } 236 237 244 245 public boolean isValidating() { 246 return validating; 247 } 248 249 257 258 public boolean isIgnoringElementContentWhitespace() { 259 return whitespace; 260 } 261 262 269 270 public boolean isExpandEntityReferences() { 271 return expandEntityRef; 272 } 273 274 281 282 public boolean isIgnoringComments() { 283 return ignoreComments; 284 } 285 286 295 296 public boolean isCoalescing() { 297 return coalescing; 298 } 299 300 308 public abstract void setAttribute(String name, Object value) 309 throws IllegalArgumentException ; 310 311 319 public abstract Object getAttribute(String name) 320 throws IllegalArgumentException ; 321 322 357 public abstract void setFeature(String name, boolean value) 358 throws ParserConfigurationException ; 359 360 378 public abstract boolean getFeature(String name) 379 throws ParserConfigurationException ; 380 381 382 386 391 392 393 411 public Schema getSchema() { 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 427 432 433 488 public void setSchema(Schema schema) { 489 throw new UnsupportedOperationException ( 490 "This parser does not support specification \"" 491 + this.getClass().getPackage().getSpecificationTitle() 492 + "\" version \"" 493 + this.getClass().getPackage().getSpecificationVersion() 494 + "\"" 495 ); 496 } 497 498 499 500 519 public void setXIncludeAware(final boolean state) { 520 throw new UnsupportedOperationException ( 521 "This parser does not support specification \"" 522 + this.getClass().getPackage().getSpecificationTitle() 523 + "\" version \"" 524 + this.getClass().getPackage().getSpecificationVersion() 525 + "\"" 526 ); 527 } 528 529 541 public boolean isXIncludeAware() { 542 throw new UnsupportedOperationException ( 543 "This parser does not support specification \"" 544 + this.getClass().getPackage().getSpecificationTitle() 545 + "\" version \"" 546 + this.getClass().getPackage().getSpecificationVersion() 547 + "\"" 548 ); 549 } 550 } 551 | Popular Tags |