3 */ 4 /* 5 * Licensed to the Apache Software Foundation (ASF) under one or more 6 * contributor license agreements. See the NOTICE file distributed with 7 * this work for additional information regarding copyright ownership. 8 * The ASF licenses this file to You under the Apache License, Version 2.0 9 * (the "License"); you may not use this file except in compliance with 10 * the License. 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.parsers; 22 23 import java.io.IOException; 24 import java.util.ArrayList; 25 import java.util.HashMap; 26 import java.util.Locale; 27 import javax.xml.XMLConstants; 28 29 import com.sun.org.apache.xerces.internal.impl.Constants; 30 import com.sun.org.apache.xerces.internal.impl.XML11DTDScannerImpl; 31 import com.sun.org.apache.xerces.internal.impl.XML11DocumentScannerImpl; 32 import com.sun.org.apache.xerces.internal.impl.XML11NSDocumentScannerImpl; 33 import com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl; 34 import com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl; 35 import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler; 36 import com.sun.org.apache.xerces.internal.impl.XMLEntityManager; 37 import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter; 38 import com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl; 39 import com.sun.org.apache.xerces.internal.impl.XMLVersionDetector; 40 import com.sun.org.apache.xerces.internal.impl.dtd.XML11DTDProcessor; 41 import com.sun.org.apache.xerces.internal.impl.dtd.XML11DTDValidator; 42 import com.sun.org.apache.xerces.internal.impl.dtd.XML11NSDTDValidator; 43 import com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDProcessor; 44 import com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator; 45 import com.sun.org.apache.xerces.internal.impl.dtd.XMLNSDTDValidator; 46 import com.sun.org.apache.xerces.internal.impl.dv.DTDDVFactory; 47 import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter; 48 import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager; 49 import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator; 50 import com.sun.org.apache.xerces.internal.impl.xs.XSMessageFormatter; 51 import com.sun.org.apache.xerces.internal.util.FeatureState; 52 import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings; 53 import com.sun.org.apache.xerces.internal.util.PropertyState; 54 import com.sun.org.apache.xerces.internal.util.SymbolTable; 55 import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager; 56 import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler; 57 import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler; 58 import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler; 59 import com.sun.org.apache.xerces.internal.xni.XMLLocator; 60 import com.sun.org.apache.xerces.internal.xni.XNIException; 61 import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool; 62 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent; 63 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager; 64 import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; 65 import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner; 66 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner; 67 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource; 68 import com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver; 69 import com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler; 70 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; 71 import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration; 72 73 /** 74 * This class is the configuration used to parse XML 1.0 and XML 1.1 documents. 75 * 76 * @author Elena Litani, IBM 77 * @author Neil Graham, IBM 78 * @author Michael Glavassevich, IBM 79 * 80 */ 81 public class XML11Configuration extends ParserConfigurationSettings 82 implements XMLPullParserConfiguration, XML11Configurable { 83 84 // 85 // Constants 86 // 87 protected final static String XML11_DATATYPE_VALIDATOR_FACTORY = 88 "com.sun.org.apache.xerces.internal.impl.dv.dtd.XML11DTDDVFactoryImpl"; 89 90 // feature identifiers 91 461 * 462 * @param symbolTable The symbol table to use. 463 * @param grammarPool The grammar pool to use. 464 * @param parentSettings The parent settings. 465 */ 466 public XML11Configuration( 467 SymbolTable symbolTable, 468 XMLGrammarPool grammarPool, 469 XMLComponentManager parentSettings) { 470 471 super(parentSettings); 472 473 // create a vector to hold all the components in use 474 // XML 1.0 specialized components 475 fComponents = new ArrayList<>(); 476 // XML 1.1 specialized components 477 fXML11Components = new ArrayList<>(); 478 // Common components for XML 1.1. and XML 1.0 479 fCommonComponents = new ArrayList<>(); 480 481 // create table for features and properties 482 fFeatures = new HashMap<>(); 483 fProperties = new HashMap<>(); 484 485 // add default recognized features 486 final String[] recognizedFeatures = 487 { 488 CONTINUE_AFTER_FATAL_ERROR, LOAD_EXTERNAL_DTD, // from XMLDTDScannerImpl 489 VALIDATION, 490 NAMESPACES, 491 NORMALIZE_DATA, SCHEMA_ELEMENT_DEFAULT, SCHEMA_AUGMENT_PSVI, 492 GENERATE_SYNTHETIC_ANNOTATIONS, VALIDATE_ANNOTATIONS, 493 HONOUR_ALL_SCHEMALOCATIONS, IGNORE_XSI_TYPE, 494 ID_IDREF_CHECKING, IDENTITY_CONSTRAINT_CHECKING, 495 UNPARSED_ENTITY_CHECKING, 496 NAMESPACE_GROWTH, TOLERATE_DUPLICATES, 497 USE_GRAMMAR_POOL_ONLY, 498 // NOTE: These shouldn't really be here but since the XML Schema 499 // validator is constructed dynamically, its recognized 500 // features might not have been set and it would cause a 501 // not-recognized exception to be thrown. -Ac 502 XMLSCHEMA_VALIDATION, XMLSCHEMA_FULL_CHECKING, 503 EXTERNAL_GENERAL_ENTITIES, 504 EXTERNAL_PARAMETER_ENTITIES, 505 PARSER_SETTINGS, 506 XMLConstants.FEATURE_SECURE_PROCESSING 507 }; 508 addRecognizedFeatures(recognizedFeatures); 509 // set state for default features 510 fFeatures.put(VALIDATION, Boolean.FALSE); 511 fFeatures.put(NAMESPACES, Boolean.TRUE); 512 fFeatures.put(EXTERNAL_GENERAL_ENTITIES, Boolean.TRUE); 513 fFeatures.put(EXTERNAL_PARAMETER_ENTITIES, Boolean.TRUE); 514 fFeatures.put(CONTINUE_AFTER_FATAL_ERROR, Boolean.FALSE); 515 fFeatures.put(LOAD_EXTERNAL_DTD, Boolean.TRUE); 516 fFeatures.put(SCHEMA_ELEMENT_DEFAULT, Boolean.TRUE); 517 fFeatures.put(NORMALIZE_DATA, Boolean.TRUE); 518 fFeatures.put(SCHEMA_AUGMENT_PSVI, Boolean.TRUE); 519 fFeatures.put(GENERATE_SYNTHETIC_ANNOTATIONS, Boolean.FALSE); 520 fFeatures.put(VALIDATE_ANNOTATIONS, Boolean.FALSE); 521 fFeatures.put(HONOUR_ALL_SCHEMALOCATIONS, Boolean.FALSE); 522 fFeatures.put(IGNORE_XSI_TYPE, Boolean.FALSE); 523 fFeatures.put(ID_IDREF_CHECKING, Boolean.TRUE); 524 fFeatures.put(IDENTITY_CONSTRAINT_CHECKING, Boolean.TRUE); 525 fFeatures.put(UNPARSED_ENTITY_CHECKING, Boolean.TRUE); 526 fFeatures.put(NAMESPACE_GROWTH, Boolean.FALSE); 527 fFeatures.put(TOLERATE_DUPLICATES, Boolean.FALSE); 528 fFeatures.put(USE_GRAMMAR_POOL_ONLY, Boolean.FALSE); 529 fFeatures.put(PARSER_SETTINGS, Boolean.TRUE); 530 fFeatures.put(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); 531 532 // add default recognized properties 533 final String[] recognizedProperties = 534 { 535 SYMBOL_TABLE, 536 ERROR_HANDLER, 537 ENTITY_RESOLVER, 538 ERROR_REPORTER, 539 ENTITY_MANAGER, 540 DOCUMENT_SCANNER, 541 DTD_SCANNER, 542 DTD_PROCESSOR, 543 DTD_VALIDATOR, 544 DATATYPE_VALIDATOR_FACTORY, 545 VALIDATION_MANAGER, 546 SCHEMA_VALIDATOR, 547 XML_STRING, 548 XMLGRAMMAR_POOL, 549 JAXP_SCHEMA_SOURCE, 550 JAXP_SCHEMA_LANGUAGE, 551 // NOTE: These shouldn't really be here but since the XML Schema 552 // validator is constructed dynamically, its recognized 553 // properties might not have been set and it would cause a 554 // not-recognized exception to be thrown. -Ac 555 SCHEMA_LOCATION, 556 SCHEMA_NONS_LOCATION, 557 ROOT_TYPE_DEF, 558 ROOT_ELEMENT_DECL, 559 LOCALE, 560 SCHEMA_DV_FACTORY, 561 SECURITY_MANAGER, 562 XML_SECURITY_PROPERTY_MANAGER 563 }; 564 addRecognizedProperties(recognizedProperties); 565 566 if (symbolTable == null) { 567 symbolTable = new SymbolTable(); 568 } 569 fSymbolTable = symbolTable; 570 fProperties.put(SYMBOL_TABLE, fSymbolTable); 571 572 fGrammarPool = grammarPool; 573 if (fGrammarPool != null) { 574 fProperties.put(XMLGRAMMAR_POOL, fGrammarPool); 575 } 576 577 fEntityManager = new XMLEntityManager(); 578 fProperties.put(ENTITY_MANAGER, fEntityManager); 579 addCommonComponent(fEntityManager); 580 581 fErrorReporter = new XMLErrorReporter(); 582 fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner()); 603 fProperties.put(DATATYPE_VALIDATOR_FACTORY, fDatatypeValidatorFactory); 604 605 fValidationManager = new ValidationManager(); 606 fProperties.put(VALIDATION_MANAGER, fValidationManager); 607 608 fVersionDetector = new XMLVersionDetector(); 609 610 // add message formatters 611 if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) { 612 XMLMessageFormatter xmft = new XMLMessageFormatter(); 613 fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft); 614 fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft); 615 } 616 617 // set locale 618 try { 619 setLocale(Locale.getDefault()); 620 } catch (XNIException e) { 621 // do nothing 622 // REVISIT: What is the right thing to do? -Ac 623 } 624 625 fConfigUpdated = false; 626 } // <init>(SymbolTable,XMLGrammarPool) 627 628 // 629 // Public methods 630 // 631 /** 632 * Sets the input source for the document to parse. 633 * 634 * @param inputSource The document's input source. 635 * 636 * @exception XMLConfigurationException Thrown if there is a 637 * configuration error when initializing the 638 * parser. 639 * @exception IOException Thrown on I/O error. 640 * 641 * @see #parse(boolean) 642 */ | 3 */ 4 /* 5 * Licensed to the Apache Software Foundation (ASF) under one or more 6 * contributor license agreements. See the NOTICE file distributed with 7 * this work for additional information regarding copyright ownership. 8 * The ASF licenses this file to You under the Apache License, Version 2.0 9 * (the "License"); you may not use this file except in compliance with 10 * the License. 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.parsers; 22 23 import com.sun.org.apache.xerces.internal.impl.Constants; 24 import com.sun.org.apache.xerces.internal.impl.XML11DTDScannerImpl; 25 import com.sun.org.apache.xerces.internal.impl.XML11DocumentScannerImpl; 26 import com.sun.org.apache.xerces.internal.impl.XML11NSDocumentScannerImpl; 27 import com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl; 28 import com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl; 29 import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler; 30 import com.sun.org.apache.xerces.internal.impl.XMLEntityManager; 31 import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter; 32 import com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl; 33 import com.sun.org.apache.xerces.internal.impl.XMLVersionDetector; 34 import com.sun.org.apache.xerces.internal.impl.dtd.XML11DTDProcessor; 35 import com.sun.org.apache.xerces.internal.impl.dtd.XML11DTDValidator; 36 import com.sun.org.apache.xerces.internal.impl.dtd.XML11NSDTDValidator; 37 import com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDProcessor; 38 import com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator; 39 import com.sun.org.apache.xerces.internal.impl.dtd.XMLNSDTDValidator; 40 import com.sun.org.apache.xerces.internal.impl.dv.DTDDVFactory; 41 import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter; 42 import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager; 43 import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator; 44 import com.sun.org.apache.xerces.internal.impl.xs.XSMessageFormatter; 45 import com.sun.org.apache.xerces.internal.util.FeatureState; 46 import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings; 47 import com.sun.org.apache.xerces.internal.util.PropertyState; 48 import com.sun.org.apache.xerces.internal.util.SymbolTable; 49 import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler; 50 import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler; 51 import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler; 52 import com.sun.org.apache.xerces.internal.xni.XMLLocator; 53 import com.sun.org.apache.xerces.internal.xni.XNIException; 54 import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool; 55 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent; 56 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager; 57 import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; 58 import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner; 59 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner; 60 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource; 61 import com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver; 62 import com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler; 63 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; 64 import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration; 65 import java.io.IOException; 66 import java.util.ArrayList; 67 import java.util.Locale; 68 import javax.xml.XMLConstants; 69 import javax.xml.catalog.CatalogFeatures; 70 import jdk.xml.internal.JdkXmlUtils; 71 import jdk.xml.internal.SecuritySupport; 72 73 /** 74 * This class is the configuration used to parse XML 1.0 and XML 1.1 documents. 75 * 76 * @author Elena Litani, IBM 77 * @author Neil Graham, IBM 78 * @author Michael Glavassevich, IBM 79 * 80 */ 81 public class XML11Configuration extends ParserConfigurationSettings 82 implements XMLPullParserConfiguration, XML11Configurable { 83 84 // 85 // Constants 86 // 87 protected final static String XML11_DATATYPE_VALIDATOR_FACTORY = 88 "com.sun.org.apache.xerces.internal.impl.dv.dtd.XML11DTDDVFactoryImpl"; 89 90 // feature identifiers 91 461 * 462 * @param symbolTable The symbol table to use. 463 * @param grammarPool The grammar pool to use. 464 * @param parentSettings The parent settings. 465 */ 466 public XML11Configuration( 467 SymbolTable symbolTable, 468 XMLGrammarPool grammarPool, 469 XMLComponentManager parentSettings) { 470 471 super(parentSettings); 472 473 // create a vector to hold all the components in use 474 // XML 1.0 specialized components 475 fComponents = new ArrayList<>(); 476 // XML 1.1 specialized components 477 fXML11Components = new ArrayList<>(); 478 // Common components for XML 1.1. and XML 1.0 479 fCommonComponents = new ArrayList<>(); 480 481 // add default recognized features 482 final String[] recognizedFeatures = 483 { 484 CONTINUE_AFTER_FATAL_ERROR, LOAD_EXTERNAL_DTD, // from XMLDTDScannerImpl 485 VALIDATION, 486 NAMESPACES, 487 NORMALIZE_DATA, SCHEMA_ELEMENT_DEFAULT, SCHEMA_AUGMENT_PSVI, 488 GENERATE_SYNTHETIC_ANNOTATIONS, VALIDATE_ANNOTATIONS, 489 HONOUR_ALL_SCHEMALOCATIONS, IGNORE_XSI_TYPE, 490 ID_IDREF_CHECKING, IDENTITY_CONSTRAINT_CHECKING, 491 UNPARSED_ENTITY_CHECKING, 492 NAMESPACE_GROWTH, TOLERATE_DUPLICATES, 493 USE_GRAMMAR_POOL_ONLY, 494 // NOTE: These shouldn't really be here but since the XML Schema 495 // validator is constructed dynamically, its recognized 496 // features might not have been set and it would cause a 497 // not-recognized exception to be thrown. -Ac 498 XMLSCHEMA_VALIDATION, XMLSCHEMA_FULL_CHECKING, 499 EXTERNAL_GENERAL_ENTITIES, 500 EXTERNAL_PARAMETER_ENTITIES, 501 PARSER_SETTINGS, 502 XMLConstants.FEATURE_SECURE_PROCESSING, 503 XMLConstants.USE_CATALOG 504 }; 505 addRecognizedFeatures(recognizedFeatures); 506 // set state for default features 507 fFeatures.put(VALIDATION, Boolean.FALSE); 508 fFeatures.put(NAMESPACES, Boolean.TRUE); 509 fFeatures.put(EXTERNAL_GENERAL_ENTITIES, Boolean.TRUE); 510 fFeatures.put(EXTERNAL_PARAMETER_ENTITIES, Boolean.TRUE); 511 fFeatures.put(CONTINUE_AFTER_FATAL_ERROR, Boolean.FALSE); 512 fFeatures.put(LOAD_EXTERNAL_DTD, Boolean.TRUE); 513 fFeatures.put(SCHEMA_ELEMENT_DEFAULT, Boolean.TRUE); 514 fFeatures.put(NORMALIZE_DATA, Boolean.TRUE); 515 fFeatures.put(SCHEMA_AUGMENT_PSVI, Boolean.TRUE); 516 fFeatures.put(GENERATE_SYNTHETIC_ANNOTATIONS, Boolean.FALSE); 517 fFeatures.put(VALIDATE_ANNOTATIONS, Boolean.FALSE); 518 fFeatures.put(HONOUR_ALL_SCHEMALOCATIONS, Boolean.FALSE); 519 fFeatures.put(IGNORE_XSI_TYPE, Boolean.FALSE); 520 fFeatures.put(ID_IDREF_CHECKING, Boolean.TRUE); 521 fFeatures.put(IDENTITY_CONSTRAINT_CHECKING, Boolean.TRUE); 522 fFeatures.put(UNPARSED_ENTITY_CHECKING, Boolean.TRUE); 523 fFeatures.put(NAMESPACE_GROWTH, Boolean.FALSE); 524 fFeatures.put(TOLERATE_DUPLICATES, Boolean.FALSE); 525 fFeatures.put(USE_GRAMMAR_POOL_ONLY, Boolean.FALSE); 526 fFeatures.put(PARSER_SETTINGS, Boolean.TRUE); 527 fFeatures.put(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); 528 fFeatures.put(XMLConstants.USE_CATALOG, JdkXmlUtils.USE_CATALOG_DEFAULT); 529 530 // add default recognized properties 531 final String[] recognizedProperties = 532 { 533 SYMBOL_TABLE, 534 ERROR_HANDLER, 535 ENTITY_RESOLVER, 536 ERROR_REPORTER, 537 ENTITY_MANAGER, 538 DOCUMENT_SCANNER, 539 DTD_SCANNER, 540 DTD_PROCESSOR, 541 DTD_VALIDATOR, 542 DATATYPE_VALIDATOR_FACTORY, 543 VALIDATION_MANAGER, 544 SCHEMA_VALIDATOR, 545 XML_STRING, 546 XMLGRAMMAR_POOL, 547 JAXP_SCHEMA_SOURCE, 548 JAXP_SCHEMA_LANGUAGE, 549 // NOTE: These shouldn't really be here but since the XML Schema 550 // validator is constructed dynamically, its recognized 551 // properties might not have been set and it would cause a 552 // not-recognized exception to be thrown. -Ac 553 SCHEMA_LOCATION, 554 SCHEMA_NONS_LOCATION, 555 ROOT_TYPE_DEF, 556 ROOT_ELEMENT_DECL, 557 LOCALE, 558 SCHEMA_DV_FACTORY, 559 SECURITY_MANAGER, 560 XML_SECURITY_PROPERTY_MANAGER, 561 JdkXmlUtils.CATALOG_DEFER, 562 JdkXmlUtils.CATALOG_FILES, 563 JdkXmlUtils.CATALOG_PREFER, 564 JdkXmlUtils.CATALOG_RESOLVE 565 }; 566 addRecognizedProperties(recognizedProperties); 567 568 if (symbolTable == null) { 569 symbolTable = new SymbolTable(); 570 } 571 fSymbolTable = symbolTable; 572 fProperties.put(SYMBOL_TABLE, fSymbolTable); 573 574 fGrammarPool = grammarPool; 575 if (fGrammarPool != null) { 576 fProperties.put(XMLGRAMMAR_POOL, fGrammarPool); 577 } 578 579 fEntityManager = new XMLEntityManager(); 580 fProperties.put(ENTITY_MANAGER, fEntityManager); 581 addCommonComponent(fEntityManager); 582 583 fErrorReporter = new XMLErrorReporter(); 584 fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner()); 605 fProperties.put(DATATYPE_VALIDATOR_FACTORY, fDatatypeValidatorFactory); 606 607 fValidationManager = new ValidationManager(); 608 fProperties.put(VALIDATION_MANAGER, fValidationManager); 609 610 fVersionDetector = new XMLVersionDetector(); 611 612 // add message formatters 613 if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) { 614 XMLMessageFormatter xmft = new XMLMessageFormatter(); 615 fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft); 616 fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft); 617 } 618 619 // set locale 620 try { 621 setLocale(Locale.getDefault()); 622 } catch (XNIException e) { 623 // do nothing 624 // REVISIT: What is the right thing to do? -Ac 625 } 626 627 // Initialize Catalog features 628 for( CatalogFeatures.Feature f : CatalogFeatures.Feature.values()) { 629 fProperties.put(f.getPropertyName(), null); 630 } 631 632 fConfigUpdated = false; 633 } // <init>(SymbolTable,XMLGrammarPool) 634 635 // 636 // Public methods 637 // 638 /** 639 * Sets the input source for the document to parse. 640 * 641 * @param inputSource The document's input source. 642 * 643 * @exception XMLConfigurationException Thrown if there is a 644 * configuration error when initializing the 645 * parser. 646 * @exception IOException Thrown on I/O error. 647 * 648 * @see #parse(boolean) 649 */ |