1 /* 2 * reserved comment block 3 * DO NOT REMOVE OR ALTER! 4 */ 5 /* 6 * Copyright 2000-2005 The Apache Software Foundation. 7 * 8 * Licensed under the Apache License, Version 2.0 (the "License"); 9 * you may not use this file except in compliance with the License. 10 * You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 */ 20 21 package com.sun.org.apache.xerces.internal.jaxp; 22 23 import java.io.IOException; 24 import java.util.HashMap; 25 import java.util.Hashtable; 26 import java.util.Iterator; 27 import java.util.Map; 28 29 import javax.xml.XMLConstants; 30 import javax.xml.validation.Schema; 31 32 import com.sun.org.apache.xerces.internal.impl.Constants; 33 import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager; 34 import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator; 35 import com.sun.org.apache.xerces.internal.jaxp.validation.XSGrammarPoolContainer; 36 import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter; 37 import com.sun.org.apache.xerces.internal.util.SecurityManager; 38 import com.sun.org.apache.xerces.internal.util.Status; 39 import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler; 40 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent; 41 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager; 42 import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; 43 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource; 44 import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration; 45 import com.sun.org.apache.xerces.internal.xs.AttributePSVI; 46 import com.sun.org.apache.xerces.internal.xs.ElementPSVI; 47 import com.sun.org.apache.xerces.internal.xs.PSVIProvider; 48 import org.xml.sax.EntityResolver; 49 import org.xml.sax.ErrorHandler; 50 import org.xml.sax.HandlerBase; 51 import org.xml.sax.InputSource; 52 import org.xml.sax.Parser; 53 import org.xml.sax.SAXException; 54 import org.xml.sax.SAXNotRecognizedException; 55 import org.xml.sax.SAXNotSupportedException; 56 import org.xml.sax.XMLReader; 57 import org.xml.sax.helpers.DefaultHandler; 58 59 /** 60 * This is the implementation specific class for the 61 * <code>javax.xml.parsers.SAXParser</code>. 62 * 63 * @author Rajiv Mordani 64 * @author Edwin Goei 65 * 66 * @version $Id: SAXParserImpl.java,v 1.7 2010-11-01 04:40:06 joehw Exp $ 67 */ 68 public class SAXParserImpl extends javax.xml.parsers.SAXParser 69 implements JAXPConstants, PSVIProvider { 70 71 /** Feature identifier: namespaces. */ 72 private static final String NAMESPACES_FEATURE = 73 Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE; 74 75 /** Feature identifier: namespace prefixes. */ 76 private static final String NAMESPACE_PREFIXES_FEATURE = 77 Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACE_PREFIXES_FEATURE; 78 79 /** Feature identifier: validation. */ 80 private static final String VALIDATION_FEATURE = 81 Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE; 82 83 /** Feature identifier: XML Schema validation */ 84 private static final String XMLSCHEMA_VALIDATION_FEATURE = 85 Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_VALIDATION_FEATURE; 86 87 /** Feature identifier: XInclude processing */ 88 private static final String XINCLUDE_FEATURE = 89 Constants.XERCES_FEATURE_PREFIX + Constants.XINCLUDE_FEATURE; 90 91 /** Property identifier: security manager. */ 92 private static final String SECURITY_MANAGER = 93 Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY; 94 95 private final JAXPSAXParser xmlReader; 96 private String schemaLanguage = null; // null means DTD 97 private final Schema grammar; 98 99 private final XMLComponent fSchemaValidator; 100 private final XMLComponentManager fSchemaValidatorComponentManager; 101 private final ValidationManager fSchemaValidationManager; 102 private final UnparsedEntityHandler fUnparsedEntityHandler; 103 104 /** Initial ErrorHandler */ 105 private final ErrorHandler fInitErrorHandler; 106 107 /** Initial EntityResolver */ 108 private final EntityResolver fInitEntityResolver; 109 110 /** 111 * Create a SAX parser with the associated features 112 * @param features Hashtable of SAX features, may be null 113 */ 114 SAXParserImpl(SAXParserFactoryImpl spf, Hashtable features) 115 throws SAXException { 116 this(spf, features, false); 117 } 118 119 /** 120 * Create a SAX parser with the associated features 121 * @param features Hashtable of SAX features, may be null 122 */ 123 SAXParserImpl(SAXParserFactoryImpl spf, Hashtable features, boolean secureProcessing) 124 throws SAXException 125 { 126 // Instantiate a SAXParser directly and not through SAX so that we use the right ClassLoader 127 xmlReader = new JAXPSAXParser(this); 128 129 // JAXP "namespaceAware" == SAX Namespaces feature 130 // Note: there is a compatibility problem here with default values: 131 // JAXP default is false while SAX 2 default is true! 132 xmlReader.setFeature0(NAMESPACES_FEATURE, spf.isNamespaceAware()); 133 134 // SAX "namespaces" and "namespace-prefixes" features should not 135 // both be false. We make them opposite for backward compatibility 136 // since JAXP 1.0 apps may want to receive xmlns* attributes. 137 xmlReader.setFeature0(NAMESPACE_PREFIXES_FEATURE, !spf.isNamespaceAware()); 138 139 // Avoid setting the XInclude processing feature if the value is false. 140 // This will keep the configuration from throwing an exception if it 141 // does not support XInclude. 142 if (spf.isXIncludeAware()) { 143 xmlReader.setFeature0(XINCLUDE_FEATURE, true); 144 } 145 146 // If the secure processing feature is on set a security manager. 147 if (secureProcessing) { 148 xmlReader.setProperty0(SECURITY_MANAGER, new SecurityManager()); 149 } 150 151 // Set application's features, followed by validation features. 152 setFeatures(features); 153 154 // If validating, provide a default ErrorHandler that prints 155 // validation errors with a warning telling the user to set an 156 // ErrorHandler. 157 if (spf.isValidating()) { 158 fInitErrorHandler = new DefaultValidationErrorHandler(); 159 xmlReader.setErrorHandler(fInitErrorHandler); 160 } 161 else { 162 fInitErrorHandler = xmlReader.getErrorHandler(); 163 } 164 xmlReader.setFeature0(VALIDATION_FEATURE, spf.isValidating()); 165 166 // Get the Schema object from the factory 167 this.grammar = spf.getSchema(); 168 if (grammar != null) { 169 XMLParserConfiguration config = xmlReader.getXMLParserConfiguration(); 170 XMLComponent validatorComponent = null; 171 /** For Xerces grammars, use built-in schema validator. **/ 172 if (grammar instanceof XSGrammarPoolContainer) { 173 validatorComponent = new XMLSchemaValidator(); 174 fSchemaValidationManager = new ValidationManager(); 175 fUnparsedEntityHandler = new UnparsedEntityHandler(fSchemaValidationManager); 176 config.setDTDHandler(fUnparsedEntityHandler); 177 fUnparsedEntityHandler.setDTDHandler(xmlReader); 178 xmlReader.setDTDSource(fUnparsedEntityHandler); 179 fSchemaValidatorComponentManager = new SchemaValidatorConfiguration(config, 180 (XSGrammarPoolContainer) grammar, fSchemaValidationManager); 181 } 182 /** For third party grammars, use the JAXP validator component. **/ 183 else { 184 validatorComponent = new JAXPValidatorComponent(grammar.newValidatorHandler()); 185 fSchemaValidationManager = null; 186 fUnparsedEntityHandler = null; 187 fSchemaValidatorComponentManager = config; 188 } 189 config.addRecognizedFeatures(validatorComponent.getRecognizedFeatures()); 190 config.addRecognizedProperties(validatorComponent.getRecognizedProperties()); 191 config.setDocumentHandler((XMLDocumentHandler) validatorComponent); 192 ((XMLDocumentSource)validatorComponent).setDocumentHandler(xmlReader); 193 xmlReader.setDocumentSource((XMLDocumentSource) validatorComponent); 194 fSchemaValidator = validatorComponent; 195 } 196 else { 197 fSchemaValidationManager = null; 198 fUnparsedEntityHandler = null; 199 fSchemaValidatorComponentManager = null; 200 fSchemaValidator = null; 201 } 202 203 // Initial EntityResolver 204 fInitEntityResolver = xmlReader.getEntityResolver(); 205 } 206 207 /** 208 * Set any features of our XMLReader based on any features set on the 209 * SAXParserFactory. 210 * 211 * XXX Does not handle possible conflicts between SAX feature names and 212 * JAXP specific feature names, eg. SAXParserFactory.isValidating() 213 */ 214 private void setFeatures(Hashtable features) 215 throws SAXNotSupportedException, SAXNotRecognizedException { 216 if (features != null) { 217 Iterator entries = features.entrySet().iterator(); 218 while (entries.hasNext()) { 219 Map.Entry entry = (Map.Entry) entries.next(); 220 String feature = (String) entry.getKey(); 221 boolean value = ((Boolean) entry.getValue()).booleanValue(); 222 xmlReader.setFeature0(feature, value); 223 } 224 } 225 } 226 227 public Parser getParser() throws SAXException { 228 // Xerces2 AbstractSAXParser implements SAX1 Parser 229 // assert(xmlReader instanceof Parser); 230 return (Parser) xmlReader; 231 } 232 233 /** 234 * Returns the XMLReader that is encapsulated by the implementation of 235 * this class. 236 */ 237 public XMLReader getXMLReader() { 238 return xmlReader; 239 } 240 241 public boolean isNamespaceAware() { 242 try { 243 return xmlReader.getFeature(NAMESPACES_FEATURE); 244 } 245 catch (SAXException x) { 246 throw new IllegalStateException(x.getMessage()); 247 } 248 } 249 250 public boolean isValidating() { 251 try { 252 return xmlReader.getFeature(VALIDATION_FEATURE); 253 } 254 catch (SAXException x) { 255 throw new IllegalStateException(x.getMessage()); 256 } 257 } 258 259 /** 260 * Gets the XInclude processing mode for this parser 261 * @return the state of XInclude processing mode 262 */ 263 public boolean isXIncludeAware() { 264 try { 265 return xmlReader.getFeature(XINCLUDE_FEATURE); 266 } 267 catch (SAXException exc) { 268 return false; 269 } 270 } 271 272 /** 273 * Sets the particular property in the underlying implementation of 274 * org.xml.sax.XMLReader. 275 */ 276 public void setProperty(String name, Object value) 277 throws SAXNotRecognizedException, SAXNotSupportedException { 278 xmlReader.setProperty(name, value); 279 } 280 281 /** 282 * returns the particular property requested for in the underlying 283 * implementation of org.xml.sax.XMLReader. 284 */ 285 public Object getProperty(String name) 286 throws SAXNotRecognizedException, SAXNotSupportedException { 287 return xmlReader.getProperty(name); 288 } 289 290 public void parse(InputSource is, DefaultHandler dh) 291 throws SAXException, IOException { 292 if (is == null) { 293 throw new IllegalArgumentException(); 294 } 295 if (dh != null) { 296 xmlReader.setContentHandler(dh); 297 xmlReader.setEntityResolver(dh); 298 xmlReader.setErrorHandler(dh); 299 xmlReader.setDTDHandler(dh); 300 xmlReader.setDocumentHandler(null); 301 } 302 xmlReader.parse(is); 303 } 304 305 public void parse(InputSource is, HandlerBase hb) 306 throws SAXException, IOException { 307 if (is == null) { 308 throw new IllegalArgumentException(); 309 } 310 if (hb != null) { 311 xmlReader.setDocumentHandler(hb); 312 xmlReader.setEntityResolver(hb); 313 xmlReader.setErrorHandler(hb); 314 xmlReader.setDTDHandler(hb); 315 xmlReader.setContentHandler(null); 316 } 317 xmlReader.parse(is); 318 } 319 320 public Schema getSchema() { 321 return grammar; 322 } 323 324 public void reset() { 325 try { 326 /** Restore initial values of features and properties. **/ 327 xmlReader.restoreInitState(); 328 } 329 catch (SAXException exc) { 330 // This should never happen. We only store recognized 331 // features and properties in the hash maps. For now 332 // just ignore it. 333 } 334 /** Restore various handlers. **/ 335 xmlReader.setContentHandler(null); 336 xmlReader.setDTDHandler(null); 337 if (xmlReader.getErrorHandler() != fInitErrorHandler) { 338 xmlReader.setErrorHandler(fInitErrorHandler); 339 } 340 if (xmlReader.getEntityResolver() != fInitEntityResolver) { 341 xmlReader.setEntityResolver(fInitEntityResolver); 342 } 343 } 344 345 /* 346 * PSVIProvider methods 347 */ 348 349 public ElementPSVI getElementPSVI() { 350 return ((PSVIProvider)xmlReader).getElementPSVI(); 351 } 352 353 public AttributePSVI getAttributePSVI(int index) { 354 return ((PSVIProvider)xmlReader).getAttributePSVI(index); 355 } 356 357 public AttributePSVI getAttributePSVIByName(String uri, String localname) { 358 return ((PSVIProvider)xmlReader).getAttributePSVIByName(uri, localname); 359 } 360 361 /** 362 * Extension of SAXParser. This class tracks changes to 363 * features and properties to allow the parser to be reset to 364 * its initial state. 365 */ 366 public static class JAXPSAXParser extends com.sun.org.apache.xerces.internal.parsers.SAXParser { 367 368 private final HashMap fInitFeatures = new HashMap(); 369 private final HashMap fInitProperties = new HashMap(); 370 private final SAXParserImpl fSAXParser; 371 372 public JAXPSAXParser() { 373 this(null); 374 } 375 376 JAXPSAXParser(SAXParserImpl saxParser) { 377 super(); 378 fSAXParser = saxParser; 379 } 380 381 /** 382 * Override SAXParser's setFeature method to track the initial state 383 * of features. This keeps us from affecting the performance of the 384 * SAXParser when it is created with XMLReaderFactory. 385 */ 386 public synchronized void setFeature(String name, boolean value) 387 throws SAXNotRecognizedException, SAXNotSupportedException { 388 if (name == null) { 389 // TODO: Add localized error message. 390 throw new NullPointerException(); 391 } 392 if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { 393 try { 394 setProperty(SECURITY_MANAGER, value ? new SecurityManager() : null); 395 } 396 catch (SAXNotRecognizedException exc) { 397 // If the property is not supported 398 // re-throw the exception if the value is true. 399 if (value) { 400 throw exc; 401 } 402 } 403 catch (SAXNotSupportedException exc) { 404 // If the property is not supported 405 // re-throw the exception if the value is true. 406 if (value) { 407 throw exc; 408 } 409 } 410 return; 411 } 412 if (!fInitFeatures.containsKey(name)) { 413 boolean current = super.getFeature(name); 414 fInitFeatures.put(name, current ? Boolean.TRUE : Boolean.FALSE); 415 } 416 /** Forward feature to the schema validator if there is one. **/ 417 if (fSAXParser != null && fSAXParser.fSchemaValidator != null) { 418 setSchemaValidatorFeature(name, value); 419 } 420 super.setFeature(name, value); 421 } 422 423 public synchronized boolean getFeature(String name) 424 throws SAXNotRecognizedException, SAXNotSupportedException { 425 if (name == null) { 426 // TODO: Add localized error message. 427 throw new NullPointerException(); 428 } 429 if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { 430 try { 431 return (super.getProperty(SECURITY_MANAGER) != null); 432 } 433 // If the property is not supported the value must be false. 434 catch (SAXException exc) { 435 return false; 436 } 437 } 438 return super.getFeature(name); 439 } 440 441 /** 442 * Override SAXParser's setProperty method to track the initial state 443 * of properties. This keeps us from affecting the performance of the 444 * SAXParser when it is created with XMLReaderFactory. 445 */ 446 public synchronized void setProperty(String name, Object value) 447 throws SAXNotRecognizedException, SAXNotSupportedException { 448 if (name == null) { 449 // TODO: Add localized error message. 450 throw new NullPointerException(); 451 } 452 if (fSAXParser != null) { 453 // JAXP 1.2 support 454 if (JAXP_SCHEMA_LANGUAGE.equals(name)) { 455 // The spec says if a schema is given via SAXParserFactory 456 // the JAXP 1.2 properties shouldn't be allowed. 457 if (fSAXParser.grammar != null) { 458 throw new SAXNotSupportedException( 459 SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), "schema-already-specified", new Object[] {name})); 460 } 461 if ( W3C_XML_SCHEMA.equals(value) ) { 462 //None of the properties will take effect till the setValidating(true) has been called 463 if( fSAXParser.isValidating() ) { 464 fSAXParser.schemaLanguage = W3C_XML_SCHEMA; 465 setFeature(XMLSCHEMA_VALIDATION_FEATURE, true); 466 // this will allow the parser not to emit DTD-related 467 // errors, as the spec demands 468 if (!fInitProperties.containsKey(JAXP_SCHEMA_LANGUAGE)) { 469 fInitProperties.put(JAXP_SCHEMA_LANGUAGE, super.getProperty(JAXP_SCHEMA_LANGUAGE)); 470 } 471 super.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA); 472 } 473 474 } 475 else if (value == null) { 476 fSAXParser.schemaLanguage = null; 477 setFeature(XMLSCHEMA_VALIDATION_FEATURE, false); 478 } 479 else { 480 // REVISIT: It would be nice if we could format this message 481 // using a user specified locale as we do in the underlying 482 // XMLReader -- mrglavas 483 throw new SAXNotSupportedException( 484 SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), "schema-not-supported", null)); 485 } 486 return; 487 } 488 else if (JAXP_SCHEMA_SOURCE.equals(name)) { 489 // The spec says if a schema is given via SAXParserFactory 490 // the JAXP 1.2 properties shouldn't be allowed. 491 if (fSAXParser.grammar != null) { 492 throw new SAXNotSupportedException( 493 SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), "schema-already-specified", new Object[] {name})); 494 } 495 String val = (String)getProperty(JAXP_SCHEMA_LANGUAGE); 496 if ( val != null && W3C_XML_SCHEMA.equals(val) ) { 497 if (!fInitProperties.containsKey(JAXP_SCHEMA_SOURCE)) { 498 fInitProperties.put(JAXP_SCHEMA_SOURCE, super.getProperty(JAXP_SCHEMA_SOURCE)); 499 } 500 super.setProperty(name, value); 501 } 502 else { 503 throw new SAXNotSupportedException( 504 SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), 505 "jaxp-order-not-supported", 506 new Object[] {JAXP_SCHEMA_LANGUAGE, JAXP_SCHEMA_SOURCE})); 507 } 508 return; 509 } 510 } 511 if (!fInitProperties.containsKey(name)) { 512 fInitProperties.put(name, super.getProperty(name)); 513 } 514 /** Forward property to the schema validator if there is one. **/ 515 if (fSAXParser != null && fSAXParser.fSchemaValidator != null) { 516 setSchemaValidatorProperty(name, value); 517 } 518 super.setProperty(name, value); 519 } 520 521 public synchronized Object getProperty(String name) 522 throws SAXNotRecognizedException, SAXNotSupportedException { 523 if (name == null) { 524 // TODO: Add localized error message. 525 throw new NullPointerException(); 526 } 527 if (fSAXParser != null && JAXP_SCHEMA_LANGUAGE.equals(name)) { 528 // JAXP 1.2 support 529 return fSAXParser.schemaLanguage; 530 } 531 return super.getProperty(name); 532 } 533 534 synchronized void restoreInitState() 535 throws SAXNotRecognizedException, SAXNotSupportedException { 536 Iterator iter; 537 if (!fInitFeatures.isEmpty()) { 538 iter = fInitFeatures.entrySet().iterator(); 539 while (iter.hasNext()) { 540 Map.Entry entry = (Map.Entry) iter.next(); 541 String name = (String) entry.getKey(); 542 boolean value = ((Boolean) entry.getValue()).booleanValue(); 543 super.setFeature(name, value); 544 } 545 fInitFeatures.clear(); 546 } 547 if (!fInitProperties.isEmpty()) { 548 iter = fInitProperties.entrySet().iterator(); 549 while (iter.hasNext()) { 550 Map.Entry entry = (Map.Entry) iter.next(); 551 String name = (String) entry.getKey(); 552 Object value = entry.getValue(); 553 super.setProperty(name, value); 554 } 555 fInitProperties.clear(); 556 } 557 } 558 559 public void parse(InputSource inputSource) 560 throws SAXException, IOException { 561 if (fSAXParser != null && fSAXParser.fSchemaValidator != null) { 562 if (fSAXParser.fSchemaValidationManager != null) { 563 fSAXParser.fSchemaValidationManager.reset(); 564 fSAXParser.fUnparsedEntityHandler.reset(); 565 } 566 resetSchemaValidator(); 567 } 568 super.parse(inputSource); 569 } 570 571 public void parse(String systemId) 572 throws SAXException, IOException { 573 if (fSAXParser != null && fSAXParser.fSchemaValidator != null) { 574 if (fSAXParser.fSchemaValidationManager != null) { 575 fSAXParser.fSchemaValidationManager.reset(); 576 fSAXParser.fUnparsedEntityHandler.reset(); 577 } 578 resetSchemaValidator(); 579 } 580 super.parse(systemId); 581 } 582 583 XMLParserConfiguration getXMLParserConfiguration() { 584 return fConfiguration; 585 } 586 587 void setFeature0(String name, boolean value) 588 throws SAXNotRecognizedException, SAXNotSupportedException { 589 super.setFeature(name, value); 590 } 591 592 boolean getFeature0(String name) 593 throws SAXNotRecognizedException, SAXNotSupportedException { 594 return super.getFeature(name); 595 } 596 597 void setProperty0(String name, Object value) 598 throws SAXNotRecognizedException, SAXNotSupportedException { 599 super.setProperty(name, value); 600 } 601 602 Object getProperty0(String name) 603 throws SAXNotRecognizedException, SAXNotSupportedException { 604 return super.getProperty(name); 605 } 606 607 private void setSchemaValidatorFeature(String name, boolean value) 608 throws SAXNotRecognizedException, SAXNotSupportedException { 609 try { 610 fSAXParser.fSchemaValidator.setFeature(name, value); 611 } 612 // This should never be thrown from the schema validator. 613 catch (XMLConfigurationException e) { 614 String identifier = e.getIdentifier(); 615 if (e.getType() == Status.NOT_RECOGNIZED) { 616 throw new SAXNotRecognizedException( 617 SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), 618 "feature-not-recognized", new Object [] {identifier})); 619 } 620 else { 621 throw new SAXNotSupportedException( 622 SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), 623 "feature-not-supported", new Object [] {identifier})); 624 } 625 } 626 } 627 628 private void setSchemaValidatorProperty(String name, Object value) 629 throws SAXNotRecognizedException, SAXNotSupportedException { 630 try { 631 fSAXParser.fSchemaValidator.setProperty(name, value); 632 } 633 // This should never be thrown from the schema validator. 634 catch (XMLConfigurationException e) { 635 String identifier = e.getIdentifier(); 636 if (e.getType() == Status.NOT_RECOGNIZED) { 637 throw new SAXNotRecognizedException( 638 SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), 639 "property-not-recognized", new Object [] {identifier})); 640 } 641 else { 642 throw new SAXNotSupportedException( 643 SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), 644 "property-not-supported", new Object [] {identifier})); 645 } 646 } 647 } 648 649 private void resetSchemaValidator() throws SAXException { 650 try { 651 fSAXParser.fSchemaValidator.reset(fSAXParser.fSchemaValidatorComponentManager); 652 } 653 // This should never be thrown from the schema validator. 654 catch (XMLConfigurationException e) { 655 throw new SAXException(e); 656 } 657 } 658 } 659 }