1 /*
   2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
   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 
  28 import com.sun.org.apache.xerces.internal.impl.Constants;
  29 import com.sun.org.apache.xerces.internal.impl.XML11DTDScannerImpl;
  30 import com.sun.org.apache.xerces.internal.impl.XML11DocumentScannerImpl;
  31 import com.sun.org.apache.xerces.internal.impl.XML11NSDocumentScannerImpl;
  32 import com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl;
  33 import com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl;
  34 import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler;
  35 import com.sun.org.apache.xerces.internal.impl.XMLEntityManager;
  36 import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
  37 import com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl;
  38 import com.sun.org.apache.xerces.internal.impl.XMLVersionDetector;
  39 import com.sun.org.apache.xerces.internal.impl.dv.DTDDVFactory;
  40 import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
  41 import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
  42 import com.sun.org.apache.xerces.internal.util.FeatureState;
  43 import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
  44 import com.sun.org.apache.xerces.internal.util.PropertyState;
  45 import com.sun.org.apache.xerces.internal.util.SymbolTable;
  46 import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler;
  47 import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler;
  48 import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
  49 import com.sun.org.apache.xerces.internal.xni.XMLLocator;
  50 import com.sun.org.apache.xerces.internal.xni.XNIException;
  51 import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool;
  52 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent;
  53 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
  54 import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
  55 import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner;
  56 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner;
  57 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource;
  58 import com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver;
  59 import com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler;
  60 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
  61 import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration;
  62 
  63 /**
  64  * This class is the non vlaidating parser configuration
  65  * used to parse XML 1.0 and XML 1.1 documents.
  66  *
  67  * Xerces parser that uses this configuration is <strong>not</strong> <a href="http://www.w3.org/TR/REC-xml#sec-conformance">conformant</a>
  68  * non-validating XML processor, since conformant non-validating processor is required
  69  * to process "all the declarations they read in the internal DTD subset ... must use the information in those declarations to normalize attribute values,
  70  * include the replacement text of internal entities, and supply default attribute values".
  71 
  72  * @author Elena Litani, IBM
  73  * @author John Kim, IBM
  74  * @author Michael Glavassevich, IBM
  75  *
  76  */
  77 public class XML11NonValidatingConfiguration extends ParserConfigurationSettings
  78     implements XMLPullParserConfiguration, XML11Configurable {
  79 
  80     //
  81     // Constants
  82     //
  83     protected final static String XML11_DATATYPE_VALIDATOR_FACTORY =
  84         "com.sun.org.apache.xerces.internal.impl.dv.dtd.XML11DTDDVFactoryImpl";
  85 
  86     // feature identifiers
  87 
  88     /** Feature identifier: validation. */
  89     protected static final String VALIDATION =
  90         Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
  91 
  92     /** Feature identifier: namespaces. */
  93     protected static final String NAMESPACES =
  94         Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE;
  95 
  96     /** Feature identifier: external general entities. */
  97     protected static final String EXTERNAL_GENERAL_ENTITIES =
  98         Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_GENERAL_ENTITIES_FEATURE;
  99 
 100     /** Feature identifier: external parameter entities. */
 101     protected static final String EXTERNAL_PARAMETER_ENTITIES =
 102         Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_PARAMETER_ENTITIES_FEATURE;
 103 
 104 
 105     /** Feature identifier: continue after fatal error. */
 106     protected static final String CONTINUE_AFTER_FATAL_ERROR =
 107         Constants.XERCES_FEATURE_PREFIX + Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE;
 108 
 109 
 110     // property identifiers
 111 
 112         /** Property identifier: xml string. */
 113         protected static final String XML_STRING =
 114                 Constants.SAX_PROPERTY_PREFIX + Constants.XML_STRING_PROPERTY;
 115 
 116         /** Property identifier: symbol table. */
 117         protected static final String SYMBOL_TABLE =
 118                 Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
 119 
 120         /** Property identifier: error handler. */
 121         protected static final String ERROR_HANDLER =
 122                 Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_HANDLER_PROPERTY;
 123 
 124         /** Property identifier: entity resolver. */
 125         protected static final String ENTITY_RESOLVER =
 126                 Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
 127 
 128     /** Property identifier: error reporter. */
 129     protected static final String ERROR_REPORTER =
 130         Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
 131 
 132     /** Property identifier: entity manager. */
 133     protected static final String ENTITY_MANAGER =
 134         Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY;
 135 
 136     /** Property identifier document scanner: */
 137     protected static final String DOCUMENT_SCANNER =
 138         Constants.XERCES_PROPERTY_PREFIX + Constants.DOCUMENT_SCANNER_PROPERTY;
 139 
 140     /** Property identifier: DTD scanner. */
 141     protected static final String DTD_SCANNER =
 142         Constants.XERCES_PROPERTY_PREFIX + Constants.DTD_SCANNER_PROPERTY;
 143 
 144     /** Property identifier: grammar pool. */
 145     protected static final String XMLGRAMMAR_POOL =
 146         Constants.XERCES_PROPERTY_PREFIX + Constants.XMLGRAMMAR_POOL_PROPERTY;
 147 
 148     /** Property identifier: DTD validator. */
 149     protected static final String DTD_VALIDATOR =
 150         Constants.XERCES_PROPERTY_PREFIX + Constants.DTD_VALIDATOR_PROPERTY;
 151 
 152     /** Property identifier: namespace binder. */
 153     protected static final String NAMESPACE_BINDER =
 154         Constants.XERCES_PROPERTY_PREFIX + Constants.NAMESPACE_BINDER_PROPERTY;
 155 
 156     /** Property identifier: datatype validator factory. */
 157     protected static final String DATATYPE_VALIDATOR_FACTORY =
 158         Constants.XERCES_PROPERTY_PREFIX + Constants.DATATYPE_VALIDATOR_FACTORY_PROPERTY;
 159 
 160     protected static final String VALIDATION_MANAGER =
 161         Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATION_MANAGER_PROPERTY;
 162 
 163     // debugging
 164 
 165     /** Set to true and recompile to print exception stack trace. */
 166     protected static final boolean PRINT_EXCEPTION_STACK_TRACE = false;
 167 
 168     //
 169     // Data
 170     //
 171     protected SymbolTable fSymbolTable;
 172     protected XMLInputSource fInputSource;
 173     protected ValidationManager fValidationManager;
 174     protected XMLVersionDetector fVersionDetector;
 175     protected XMLLocator fLocator;
 176     protected Locale fLocale;
 177 
 178     /** XML 1.0 Components. */
 179     protected ArrayList fComponents;
 180 
 181     /** XML 1.1. Components. */
 182     protected ArrayList fXML11Components = null;
 183 
 184     /** Common components: XMLEntityManager, XMLErrorReporter */
 185     protected ArrayList fCommonComponents = null;
 186 
 187     /** The document handler. */
 188     protected XMLDocumentHandler fDocumentHandler;
 189 
 190     /** The DTD handler. */
 191     protected XMLDTDHandler fDTDHandler;
 192 
 193     /** The DTD content model handler. */
 194     protected XMLDTDContentModelHandler fDTDContentModelHandler;
 195 
 196     /** Last component in the document pipeline */
 197     protected XMLDocumentSource fLastComponent;
 198 
 199     /**
 200      * True if a parse is in progress. This state is needed because
 201      * some features/properties cannot be set while parsing (e.g.
 202      * namespaces).
 203      */
 204     protected boolean fParseInProgress = false;
 205 
 206     /** fConfigUpdated is set to true if there has been any change to the configuration settings,
 207      * i.e a feature or a property was changed.
 208      */
 209     protected boolean fConfigUpdated = false;
 210 
 211     //
 212     // XML 1.0 components
 213     //
 214 
 215     /** The XML 1.0 Datatype validator factory. */
 216     protected DTDDVFactory fDatatypeValidatorFactory;
 217 
 218     /** The XML 1.0 Document scanner that does namespace binding. */
 219     protected XMLNSDocumentScannerImpl fNamespaceScanner;
 220 
 221     /** The XML 1.0 Non-namespace implementation of scanner */
 222     protected XMLDocumentScannerImpl fNonNSScanner;
 223 
 224     /** The XML 1.0 DTD scanner. */
 225     protected XMLDTDScanner fDTDScanner;
 226 
 227     //
 228     // XML 1.1 components
 229     //
 230 
 231     /** The XML 1.1 datatype factory. **/
 232     protected DTDDVFactory fXML11DatatypeFactory = null;
 233 
 234     /** The XML 1.1 document scanner that does namespace binding. **/
 235     protected XML11NSDocumentScannerImpl fXML11NSDocScanner = null;
 236 
 237     /** The XML 1.1 document scanner that does not do namespace binding. **/
 238     protected XML11DocumentScannerImpl fXML11DocScanner = null;
 239 
 240     /** The XML 1.1 DTD scanner. **/
 241     protected XML11DTDScannerImpl fXML11DTDScanner = null;
 242 
 243     //
 244     // Common components
 245     //
 246 
 247     /** Grammar pool. */
 248     protected XMLGrammarPool fGrammarPool;
 249 
 250     /** Error reporter. */
 251     protected XMLErrorReporter fErrorReporter;
 252 
 253     /** Entity manager. */
 254     protected XMLEntityManager fEntityManager;
 255 
 256     /** Current scanner */
 257     protected XMLDocumentScanner fCurrentScanner;
 258 
 259     /** Current Datatype validator factory. */
 260     protected DTDDVFactory fCurrentDVFactory;
 261 
 262     /** Current DTD scanner. */
 263     protected XMLDTDScanner fCurrentDTDScanner;
 264 
 265 
 266     /** Flag indiciating whether XML11 components have been initialized. */
 267     private boolean f11Initialized = false;
 268 
 269     //
 270     // Constructors
 271     //
 272 
 273     /** Default constructor. */
 274     public XML11NonValidatingConfiguration() {
 275         this(null, null, null);
 276     } // <init>()
 277 
 278     /**
 279      * Constructs a parser configuration using the specified symbol table.
 280      *
 281      * @param symbolTable The symbol table to use.
 282      */
 283     public XML11NonValidatingConfiguration(SymbolTable symbolTable) {
 284         this(symbolTable, null, null);
 285     } // <init>(SymbolTable)
 286 
 287     /**
 288      * Constructs a parser configuration using the specified symbol table and
 289      * grammar pool.
 290      * <p>
 291      * <strong>REVISIT:</strong>
 292      * Grammar pool will be updated when the new validation engine is
 293      * implemented.
 294      *
 295      * @param symbolTable The symbol table to use.
 296      * @param grammarPool The grammar pool to use.
 297      */
 298     public XML11NonValidatingConfiguration(SymbolTable symbolTable, XMLGrammarPool grammarPool) {
 299         this(symbolTable, grammarPool, null);
 300     } // <init>(SymbolTable,XMLGrammarPool)
 301 
 302     /**
 303      * Constructs a parser configuration using the specified symbol table,
 304      * grammar pool, and parent settings.
 305      * <p>
 306      * <strong>REVISIT:</strong>
 307      * Grammar pool will be updated when the new validation engine is
 308      * implemented.
 309      *
 310      * @param symbolTable    The symbol table to use.
 311      * @param grammarPool    The grammar pool to use.
 312      * @param parentSettings The parent settings.
 313      */
 314     public XML11NonValidatingConfiguration(
 315         SymbolTable symbolTable,
 316         XMLGrammarPool grammarPool,
 317         XMLComponentManager parentSettings) {
 318 
 319                 super(parentSettings);
 320 
 321                 // create a vector to hold all the components in use
 322                 // XML 1.0 specialized components
 323                 fComponents = new ArrayList();
 324                 // XML 1.1 specialized components
 325                 fXML11Components = new ArrayList();
 326                 // Common components for XML 1.1. and XML 1.0
 327                 fCommonComponents = new ArrayList();
 328 
 329                 // create table for features and properties
 330                 fFeatures = new HashMap();
 331                 fProperties = new HashMap();
 332 
 333         // add default recognized features
 334         final String[] recognizedFeatures =
 335             {
 336                 CONTINUE_AFTER_FATAL_ERROR, // from XMLDTDScannerImpl
 337                                 VALIDATION,
 338                                 NAMESPACES,
 339                                 EXTERNAL_GENERAL_ENTITIES,
 340                                 EXTERNAL_PARAMETER_ENTITIES,
 341                                 PARSER_SETTINGS
 342                         };
 343         addRecognizedFeatures(recognizedFeatures);
 344 
 345                 // set state for default features
 346                 fFeatures.put(VALIDATION, Boolean.FALSE);
 347                 fFeatures.put(NAMESPACES, Boolean.TRUE);
 348                 fFeatures.put(EXTERNAL_GENERAL_ENTITIES, Boolean.TRUE);
 349                 fFeatures.put(EXTERNAL_PARAMETER_ENTITIES, Boolean.TRUE);
 350                 fFeatures.put(CONTINUE_AFTER_FATAL_ERROR, Boolean.FALSE);
 351                 fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);
 352 
 353         // add default recognized properties
 354         final String[] recognizedProperties =
 355             {
 356                 XML_STRING,
 357                 SYMBOL_TABLE,
 358                                 ERROR_HANDLER,
 359                                 ENTITY_RESOLVER,
 360                 ERROR_REPORTER,
 361                 ENTITY_MANAGER,
 362                 DOCUMENT_SCANNER,
 363                 DTD_SCANNER,
 364                 DTD_VALIDATOR,
 365                                 DATATYPE_VALIDATOR_FACTORY,
 366                                 VALIDATION_MANAGER,
 367                                 XML_STRING,
 368                 XMLGRAMMAR_POOL, };
 369         addRecognizedProperties(recognizedProperties);
 370 
 371                 if (symbolTable == null) {
 372                         symbolTable = new SymbolTable();
 373                 }
 374                 fSymbolTable = symbolTable;
 375                 fProperties.put(SYMBOL_TABLE, fSymbolTable);
 376 
 377         fGrammarPool = grammarPool;
 378         if (fGrammarPool != null) {
 379                         fProperties.put(XMLGRAMMAR_POOL, fGrammarPool);
 380         }
 381 
 382         fEntityManager = new XMLEntityManager();
 383                 fProperties.put(ENTITY_MANAGER, fEntityManager);
 384         addCommonComponent(fEntityManager);
 385 
 386         fErrorReporter = new XMLErrorReporter();
 387         fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner());
 388                 fProperties.put(ERROR_REPORTER, fErrorReporter);
 389         addCommonComponent(fErrorReporter);
 390 
 391         fNamespaceScanner = new XMLNSDocumentScannerImpl();
 392                 fProperties.put(DOCUMENT_SCANNER, fNamespaceScanner);
 393         addComponent((XMLComponent) fNamespaceScanner);
 394 
 395         fDTDScanner = new XMLDTDScannerImpl();
 396                 fProperties.put(DTD_SCANNER, fDTDScanner);
 397         addComponent((XMLComponent) fDTDScanner);
 398 
 399         fDatatypeValidatorFactory = DTDDVFactory.getInstance();
 400                 fProperties.put(DATATYPE_VALIDATOR_FACTORY, fDatatypeValidatorFactory);
 401 
 402         fValidationManager = new ValidationManager();
 403                 fProperties.put(VALIDATION_MANAGER, fValidationManager);
 404 
 405         fVersionDetector = new XMLVersionDetector();
 406 
 407         // add message formatters
 408         if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
 409             XMLMessageFormatter xmft = new XMLMessageFormatter();
 410             fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
 411             fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
 412         }
 413 
 414         // set locale
 415         try {
 416             setLocale(Locale.getDefault());
 417         } catch (XNIException e) {
 418             // do nothing
 419             // REVISIT: What is the right thing to do? -Ac
 420         }
 421 
 422                 fConfigUpdated = false;
 423 
 424     } // <init>(SymbolTable,XMLGrammarPool)
 425 
 426     /**
 427      * Sets the input source for the document to parse.
 428      *
 429      * @param inputSource The document's input source.
 430      *
 431      * @exception XMLConfigurationException Thrown if there is a
 432      *                        configuration error when initializing the
 433      *                        parser.
 434      * @exception IOException Thrown on I/O error.
 435      *
 436      * @see #parse(boolean)
 437      */
 438     public void setInputSource(XMLInputSource inputSource)
 439         throws XMLConfigurationException, IOException {
 440 
 441         // REVISIT: this method used to reset all the components and
 442         //          construct the pipeline. Now reset() is called
 443         //          in parse (boolean) just before we parse the document
 444         //          Should this method still throw exceptions..?
 445 
 446         fInputSource = inputSource;
 447 
 448     } // setInputSource(XMLInputSource)
 449 
 450     /**
 451      * Set the locale to use for messages.
 452      *
 453      * @param locale The locale object to use for localization of messages.
 454      *
 455      * @exception XNIException Thrown if the parser does not support the
 456      *                         specified locale.
 457      */
 458     public void setLocale(Locale locale) throws XNIException {
 459         fLocale = locale;
 460         fErrorReporter.setLocale(locale);
 461     } // setLocale(Locale)
 462 
 463         /**
 464          * Sets the document handler on the last component in the pipeline
 465          * to receive information about the document.
 466          *
 467          * @param documentHandler   The document handler.
 468          */
 469         public void setDocumentHandler(XMLDocumentHandler documentHandler) {
 470                 fDocumentHandler = documentHandler;
 471                 if (fLastComponent != null) {
 472                         fLastComponent.setDocumentHandler(fDocumentHandler);
 473                         if (fDocumentHandler !=null){
 474                                 fDocumentHandler.setDocumentSource(fLastComponent);
 475                         }
 476                 }
 477         } // setDocumentHandler(XMLDocumentHandler)
 478 
 479         /** Returns the registered document handler. */
 480         public XMLDocumentHandler getDocumentHandler() {
 481                 return fDocumentHandler;
 482         } // getDocumentHandler():XMLDocumentHandler
 483 
 484         /**
 485          * Sets the DTD handler.
 486          *
 487          * @param dtdHandler The DTD handler.
 488          */
 489         public void setDTDHandler(XMLDTDHandler dtdHandler) {
 490                 fDTDHandler = dtdHandler;
 491         } // setDTDHandler(XMLDTDHandler)
 492 
 493         /** Returns the registered DTD handler. */
 494         public XMLDTDHandler getDTDHandler() {
 495                 return fDTDHandler;
 496         } // getDTDHandler():XMLDTDHandler
 497 
 498         /**
 499          * Sets the DTD content model handler.
 500          *
 501          * @param handler The DTD content model handler.
 502          */
 503         public void setDTDContentModelHandler(XMLDTDContentModelHandler handler) {
 504                 fDTDContentModelHandler = handler;
 505         } // setDTDContentModelHandler(XMLDTDContentModelHandler)
 506 
 507         /** Returns the registered DTD content model handler. */
 508         public XMLDTDContentModelHandler getDTDContentModelHandler() {
 509                 return fDTDContentModelHandler;
 510         } // getDTDContentModelHandler():XMLDTDContentModelHandler
 511 
 512         /**
 513          * Sets the resolver used to resolve external entities. The EntityResolver
 514          * interface supports resolution of public and system identifiers.
 515          *
 516          * @param resolver The new entity resolver. Passing a null value will
 517          *                 uninstall the currently installed resolver.
 518          */
 519         public void setEntityResolver(XMLEntityResolver resolver) {
 520                 fProperties.put(ENTITY_RESOLVER, resolver);
 521         } // setEntityResolver(XMLEntityResolver)
 522 
 523         /**
 524          * Return the current entity resolver.
 525          *
 526          * @return The current entity resolver, or null if none
 527          *         has been registered.
 528          * @see #setEntityResolver
 529          */
 530         public XMLEntityResolver getEntityResolver() {
 531                 return (XMLEntityResolver)fProperties.get(ENTITY_RESOLVER);
 532         } // getEntityResolver():XMLEntityResolver
 533 
 534         /**
 535          * Allow an application to register an error event handler.
 536          *
 537          * <p>If the application does not register an error handler, all
 538          * error events reported by the SAX parser will be silently
 539          * ignored; however, normal processing may not continue.  It is
 540          * highly recommended that all SAX applications implement an
 541          * error handler to avoid unexpected bugs.</p>
 542          *
 543          * <p>Applications may register a new or different handler in the
 544          * middle of a parse, and the SAX parser must begin using the new
 545          * handler immediately.</p>
 546          *
 547          * @param errorHandler The error handler.
 548          * @exception java.lang.NullPointerException If the handler
 549          *            argument is null.
 550          * @see #getErrorHandler
 551          */
 552         public void setErrorHandler(XMLErrorHandler errorHandler) {
 553                 fProperties.put(ERROR_HANDLER, errorHandler);
 554         } // setErrorHandler(XMLErrorHandler)
 555 
 556         /**
 557          * Return the current error handler.
 558          *
 559          * @return The current error handler, or null if none
 560          *         has been registered.
 561          * @see #setErrorHandler
 562          */
 563         public XMLErrorHandler getErrorHandler() {
 564                 // REVISIT: Should this be a property?
 565                 return (XMLErrorHandler)fProperties.get(ERROR_HANDLER);
 566         } // getErrorHandler():XMLErrorHandler
 567 
 568 
 569     /**
 570      * If the application decides to terminate parsing before the xml document
 571      * is fully parsed, the application should call this method to free any
 572      * resource allocated during parsing. For example, close all opened streams.
 573      */
 574     public void cleanup() {
 575         fEntityManager.closeReaders();
 576     }
 577 
 578     /**
 579      * Parses the specified input source.
 580      *
 581      * @param source The input source.
 582      *
 583      * @exception XNIException Throws exception on XNI error.
 584      * @exception java.io.IOException Throws exception on i/o error.
 585      */
 586     public void parse(XMLInputSource source) throws XNIException, IOException {
 587 
 588         if (fParseInProgress) {
 589             // REVISIT - need to add new error message
 590             throw new XNIException("FWK005 parse may not be called while parsing.");
 591         }
 592         fParseInProgress = true;
 593 
 594         try {
 595             setInputSource(source);
 596             parse(true);
 597         } catch (XNIException ex) {
 598             if (PRINT_EXCEPTION_STACK_TRACE)
 599                 ex.printStackTrace();
 600             throw ex;
 601         } catch (IOException ex) {
 602             if (PRINT_EXCEPTION_STACK_TRACE)
 603                 ex.printStackTrace();
 604             throw ex;
 605         } catch (RuntimeException ex) {
 606             if (PRINT_EXCEPTION_STACK_TRACE)
 607                 ex.printStackTrace();
 608             throw ex;
 609         } catch (Exception ex) {
 610             if (PRINT_EXCEPTION_STACK_TRACE)
 611                 ex.printStackTrace();
 612             throw new XNIException(ex);
 613         } finally {
 614             fParseInProgress = false;
 615             // close all streams opened by xerces
 616             this.cleanup();
 617         }
 618 
 619     } // parse(InputSource)
 620 
 621     public boolean parse(boolean complete) throws XNIException, IOException {
 622         //
 623         // reset and configure pipeline and set InputSource.
 624         if (fInputSource != null) {
 625             try {
 626                                 fValidationManager.reset();
 627                 fVersionDetector.reset(this);
 628                 resetCommon();
 629 
 630                 short version = fVersionDetector.determineDocVersion(fInputSource);
 631                 if (version == Constants.XML_VERSION_1_1) {
 632                     initXML11Components();
 633                     configureXML11Pipeline();
 634                     resetXML11();
 635                 } else {
 636                     configurePipeline();
 637                     reset();
 638                 }
 639 
 640                 // mark configuration as fixed
 641                 fConfigUpdated = false;
 642 
 643                 // resets and sets the pipeline.
 644                 fVersionDetector.startDocumentParsing((XMLEntityHandler) fCurrentScanner, version);
 645                 fInputSource = null;
 646             } catch (XNIException ex) {
 647                 if (PRINT_EXCEPTION_STACK_TRACE)
 648                     ex.printStackTrace();
 649                 throw ex;
 650             } catch (IOException ex) {
 651                 if (PRINT_EXCEPTION_STACK_TRACE)
 652                     ex.printStackTrace();
 653                 throw ex;
 654             } catch (RuntimeException ex) {
 655                 if (PRINT_EXCEPTION_STACK_TRACE)
 656                     ex.printStackTrace();
 657                 throw ex;
 658             } catch (Exception ex) {
 659                 if (PRINT_EXCEPTION_STACK_TRACE)
 660                     ex.printStackTrace();
 661                 throw new XNIException(ex);
 662             }
 663         }
 664 
 665         try {
 666             return fCurrentScanner.scanDocument(complete);
 667         } catch (XNIException ex) {
 668             if (PRINT_EXCEPTION_STACK_TRACE)
 669                 ex.printStackTrace();
 670             throw ex;
 671         } catch (IOException ex) {
 672             if (PRINT_EXCEPTION_STACK_TRACE)
 673                 ex.printStackTrace();
 674             throw ex;
 675         } catch (RuntimeException ex) {
 676             if (PRINT_EXCEPTION_STACK_TRACE)
 677                 ex.printStackTrace();
 678             throw ex;
 679         } catch (Exception ex) {
 680             if (PRINT_EXCEPTION_STACK_TRACE)
 681                 ex.printStackTrace();
 682             throw new XNIException(ex);
 683         }
 684 
 685     } // parse(boolean):boolean
 686 
 687     /**
 688      * Stops the parsing process.
 689      */
 690     @Override
 691     public boolean stop() {
 692         //no-op. this feature is implemented in the specific SAX parser.
 693         return false;
 694     }
 695 
 696     /**
 697      * Resumes parsing after it was stopped by calling the stop method.
 698      */
 699     @Override
 700     public boolean resume() {
 701         //no-op. this feature is implemented in the specific SAX parser.
 702         return false;
 703     }
 704 
 705     /**
 706      * Returns the state of a feature.
 707      *
 708      * @param featureId The feature identifier.
 709              * @return true if the feature is supported
 710      *
 711      * @throws XMLConfigurationException Thrown for configuration error.
 712      *                                   In general, components should
 713      *                                   only throw this exception if
 714      *                                   it is <strong>really</strong>
 715      *                                   a critical error.
 716      */
 717     public FeatureState getFeatureState(String featureId)
 718             throws XMLConfigurationException {
 719                     // make this feature special
 720     if (featureId.equals(PARSER_SETTINGS)){
 721             return FeatureState.is(fConfigUpdated);
 722     }
 723     return super.getFeatureState(featureId);
 724 
 725     } // getFeature(String):boolean
 726 
 727     /**
 728      * Set the state of a feature.
 729      *
 730      * Set the state of any feature in a SAX2 parser.  The parser
 731      * might not recognize the feature, and if it does recognize
 732      * it, it might not be able to fulfill the request.
 733      *
 734      * @param featureId The unique identifier (URI) of the feature.
 735      * @param state The requested state of the feature (true or false).
 736      *
 737      * @exception com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException If the
 738      *            requested feature is not known.
 739      */
 740     public void setFeature(String featureId, boolean state)
 741             throws XMLConfigurationException {
 742             fConfigUpdated = true;
 743             // forward to every XML 1.0 component
 744             int count = fComponents.size();
 745             for (int i = 0; i < count; i++) {
 746                     XMLComponent c = (XMLComponent) fComponents.get(i);
 747                     c.setFeature(featureId, state);
 748             }
 749             // forward it to common components
 750             count = fCommonComponents.size();
 751             for (int i = 0; i < count; i++) {
 752                     XMLComponent c = (XMLComponent) fCommonComponents.get(i);
 753                     c.setFeature(featureId, state);
 754             }
 755 
 756             // forward to every XML 1.1 component
 757             count = fXML11Components.size();
 758             for (int i = 0; i < count; i++) {
 759                     XMLComponent c = (XMLComponent) fXML11Components.get(i);
 760                     try{
 761                             c.setFeature(featureId, state);
 762                     }
 763                     catch (Exception e){
 764                             // no op
 765                     }
 766             }
 767             // save state if noone "objects"
 768             super.setFeature(featureId, state);
 769 
 770     } // setFeature(String,boolean)
 771 
 772     /**
 773      * setProperty
 774      *
 775      * @param propertyId
 776      * @param value
 777      */
 778     public void setProperty(String propertyId, Object value)
 779             throws XMLConfigurationException {
 780             fConfigUpdated = true;
 781             // forward to every XML 1.0 component
 782             int count = fComponents.size();
 783             for (int i = 0; i < count; i++) {
 784                     XMLComponent c = (XMLComponent) fComponents.get(i);
 785                     c.setProperty(propertyId, value);
 786             }
 787             // forward it to every common Component
 788             count = fCommonComponents.size();
 789             for (int i = 0; i < count; i++) {
 790                     XMLComponent c = (XMLComponent) fCommonComponents.get(i);
 791                     c.setProperty(propertyId, value);
 792             }
 793             // forward it to every XML 1.1 component
 794             count = fXML11Components.size();
 795             for (int i = 0; i < count; i++) {
 796                     XMLComponent c = (XMLComponent) fXML11Components.get(i);
 797                     try{
 798                             c.setProperty(propertyId, value);
 799                     }
 800                     catch (Exception e){
 801                             // ignore it
 802                     }
 803             }
 804 
 805             // store value if noone "objects"
 806             super.setProperty(propertyId, value);
 807 
 808     } // setProperty(String,Object)
 809 
 810 
 811     /** Returns the locale. */
 812     public Locale getLocale() {
 813             return fLocale;
 814     } // getLocale():Locale
 815 
 816     /**
 817      * reset all XML 1.0 components before parsing and namespace context
 818      */
 819     protected void reset() throws XNIException {
 820             int count = fComponents.size();
 821             for (int i = 0; i < count; i++) {
 822                     XMLComponent c = (XMLComponent) fComponents.get(i);
 823                     c.reset(this);
 824             }
 825 
 826     } // reset()
 827 
 828     /**
 829      * reset all common components before parsing
 830      */
 831     protected void resetCommon() throws XNIException {
 832             // reset common components
 833             int count = fCommonComponents.size();
 834             for (int i = 0; i < count; i++) {
 835                     XMLComponent c = (XMLComponent) fCommonComponents.get(i);
 836                     c.reset(this);
 837             }
 838 
 839     } // resetCommon()
 840 
 841 
 842     /**
 843      * reset all components before parsing and namespace context
 844      */
 845     protected void resetXML11() throws XNIException {
 846             // reset every component
 847             int count = fXML11Components.size();
 848             for (int i = 0; i < count; i++) {
 849                     XMLComponent c = (XMLComponent) fXML11Components.get(i);
 850                     c.reset(this);
 851             }
 852 
 853     } // resetXML11()
 854 
 855 
 856     /**
 857      *  Configures the XML 1.1 pipeline.
 858      *  Note: this method also resets the new XML11 components.
 859      */
 860     protected void configureXML11Pipeline() {
 861         if (fCurrentDVFactory != fXML11DatatypeFactory) {
 862             fCurrentDVFactory = fXML11DatatypeFactory;
 863             setProperty(DATATYPE_VALIDATOR_FACTORY, fCurrentDVFactory);
 864         }
 865 
 866         // setup DTD pipeline
 867         if (fCurrentDTDScanner != fXML11DTDScanner) {
 868             fCurrentDTDScanner = fXML11DTDScanner;
 869             setProperty(DTD_SCANNER, fCurrentDTDScanner);
 870         }
 871         fXML11DTDScanner.setDTDHandler(fDTDHandler);
 872         fXML11DTDScanner.setDTDContentModelHandler(fDTDContentModelHandler);
 873 
 874         // setup XML 1.1 document pipeline
 875         if (fFeatures.get(NAMESPACES) == Boolean.TRUE) {
 876             if (fCurrentScanner != fXML11NSDocScanner) {
 877                 fCurrentScanner = fXML11NSDocScanner;
 878                 setProperty(DOCUMENT_SCANNER, fXML11NSDocScanner);
 879             }
 880 
 881             fXML11NSDocScanner.setDTDValidator(null);
 882             fXML11NSDocScanner.setDocumentHandler(fDocumentHandler);
 883             if (fDocumentHandler != null) {
 884                 fDocumentHandler.setDocumentSource(fXML11NSDocScanner);
 885             }
 886             fLastComponent = fXML11NSDocScanner;
 887 
 888         } else {
 889                         // create components
 890                           if (fXML11DocScanner == null) {
 891                                         // non namespace document pipeline
 892                                         fXML11DocScanner = new XML11DocumentScannerImpl();
 893                                         addXML11Component(fXML11DocScanner);
 894                           }
 895             if (fCurrentScanner != fXML11DocScanner) {
 896                 fCurrentScanner = fXML11DocScanner;
 897                 setProperty(DOCUMENT_SCANNER, fXML11DocScanner);
 898             }
 899             fXML11DocScanner.setDocumentHandler(fDocumentHandler);
 900 
 901             if (fDocumentHandler != null) {
 902                 fDocumentHandler.setDocumentSource(fXML11DocScanner);
 903             }
 904             fLastComponent = fXML11DocScanner;
 905         }
 906 
 907     } // configureXML11Pipeline()
 908 
 909     /** Configures the pipeline. */
 910     protected void configurePipeline() {
 911         if (fCurrentDVFactory != fDatatypeValidatorFactory) {
 912             fCurrentDVFactory = fDatatypeValidatorFactory;
 913             // use XML 1.0 datatype library
 914             setProperty(DATATYPE_VALIDATOR_FACTORY, fCurrentDVFactory);
 915         }
 916 
 917         // setup DTD pipeline
 918         if (fCurrentDTDScanner != fDTDScanner) {
 919             fCurrentDTDScanner = fDTDScanner;
 920             setProperty(DTD_SCANNER, fCurrentDTDScanner);
 921         }
 922         fDTDScanner.setDTDHandler(fDTDHandler);
 923         fDTDScanner.setDTDContentModelHandler(fDTDContentModelHandler);
 924 
 925         // setup document pipeline
 926         if (fFeatures.get(NAMESPACES) == Boolean.TRUE) {
 927             if (fCurrentScanner != fNamespaceScanner) {
 928                 fCurrentScanner = fNamespaceScanner;
 929                 setProperty(DOCUMENT_SCANNER, fNamespaceScanner);
 930             }
 931             fNamespaceScanner.setDTDValidator(null);
 932             fNamespaceScanner.setDocumentHandler(fDocumentHandler);
 933             if (fDocumentHandler != null) {
 934                 fDocumentHandler.setDocumentSource(fNamespaceScanner);
 935             }
 936             fLastComponent = fNamespaceScanner;
 937         } else {
 938             // create components
 939             if (fNonNSScanner == null) {
 940                 fNonNSScanner = new XMLDocumentScannerImpl();
 941                 // add components
 942                 addComponent((XMLComponent) fNonNSScanner);
 943 
 944             }
 945             if (fCurrentScanner != fNonNSScanner) {
 946                 fCurrentScanner = fNonNSScanner;
 947                 setProperty(DOCUMENT_SCANNER, fNonNSScanner);
 948 
 949             }
 950 
 951             fNonNSScanner.setDocumentHandler(fDocumentHandler);
 952             if (fDocumentHandler != null) {
 953                 fDocumentHandler.setDocumentSource(fNonNSScanner);
 954             }
 955             fLastComponent = fNonNSScanner;
 956         }
 957 
 958     } // configurePipeline()
 959 
 960 
 961     // features and properties
 962 
 963     /**
 964      * Check a feature. If feature is know and supported, this method simply
 965      * returns. Otherwise, the appropriate exception is thrown.
 966      *
 967      * @param featureId The unique identifier (URI) of the feature.
 968      *
 969      * @throws XMLConfigurationException Thrown for configuration error.
 970      *                                   In general, components should
 971      *                                   only throw this exception if
 972      *                                   it is <strong>really</strong>
 973      *                                   a critical error.
 974      */
 975     protected FeatureState checkFeature(String featureId) throws XMLConfigurationException {
 976 
 977         //
 978         // Xerces Features
 979         //
 980 
 981         if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
 982             final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length();
 983 
 984             //
 985             // http://apache.org/xml/features/validation/dynamic
 986             //   Allows the parser to validate a document only when it
 987             //   contains a grammar. Validation is turned on/off based
 988             //   on each document instance, automatically.
 989             //
 990             if (suffixLength == Constants.DYNAMIC_VALIDATION_FEATURE.length() &&
 991                 featureId.endsWith(Constants.DYNAMIC_VALIDATION_FEATURE)) {
 992                 return FeatureState.RECOGNIZED;
 993             }
 994 
 995             //
 996             // http://apache.org/xml/features/validation/default-attribute-values
 997             //
 998             if (suffixLength == Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE.length() &&
 999                 featureId.endsWith(Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE)) {
1000                 // REVISIT
1001                 return FeatureState.NOT_SUPPORTED;
1002             }
1003             //
1004             // http://apache.org/xml/features/validation/default-attribute-values
1005             //
1006             if (suffixLength == Constants.VALIDATE_CONTENT_MODELS_FEATURE.length() &&
1007                 featureId.endsWith(Constants.VALIDATE_CONTENT_MODELS_FEATURE)) {
1008                 // REVISIT
1009                 return FeatureState.NOT_SUPPORTED;
1010             }
1011             //
1012             // http://apache.org/xml/features/validation/nonvalidating/load-dtd-grammar
1013             //
1014             if (suffixLength == Constants.LOAD_DTD_GRAMMAR_FEATURE.length() &&
1015                 featureId.endsWith(Constants.LOAD_DTD_GRAMMAR_FEATURE)) {
1016                 return FeatureState.RECOGNIZED;
1017             }
1018             //
1019             // http://apache.org/xml/features/validation/nonvalidating/load-external-dtd
1020             //
1021             if (suffixLength == Constants.LOAD_EXTERNAL_DTD_FEATURE.length() &&
1022                 featureId.endsWith(Constants.LOAD_EXTERNAL_DTD_FEATURE)) {
1023                 return FeatureState.RECOGNIZED;
1024             }
1025 
1026             //
1027             // http://apache.org/xml/features/validation/default-attribute-values
1028             //
1029             if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() &&
1030                 featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) {
1031                 return FeatureState.NOT_SUPPORTED;
1032             }
1033 
1034             // special performance feature: only component manager is allowed to set it.
1035             if (suffixLength == Constants.PARSER_SETTINGS.length() &&
1036                 featureId.endsWith(Constants.PARSER_SETTINGS)) {
1037                 return FeatureState.NOT_SUPPORTED;
1038             }
1039         }
1040 
1041         //
1042         // Not recognized
1043         //
1044 
1045         return super.checkFeature(featureId);
1046 
1047     } // checkFeature(String)
1048 
1049     /**
1050      * Check a property. If the property is know and supported, this method
1051      * simply returns. Otherwise, the appropriate exception is thrown.
1052      *
1053      * @param propertyId The unique identifier (URI) of the property
1054      *                   being set.
1055      *
1056      * @throws XMLConfigurationException Thrown for configuration error.
1057      *                                   In general, components should
1058      *                                   only throw this exception if
1059      *                                   it is <strong>really</strong>
1060      *                                   a critical error.
1061      */
1062     protected PropertyState checkProperty(String propertyId) throws XMLConfigurationException {
1063 
1064         //
1065         // Xerces Properties
1066         //
1067 
1068         if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
1069             final int suffixLength = propertyId.length() - Constants.XERCES_PROPERTY_PREFIX.length();
1070 
1071             if (suffixLength == Constants.DTD_SCANNER_PROPERTY.length() &&
1072                 propertyId.endsWith(Constants.DTD_SCANNER_PROPERTY)) {
1073                 return PropertyState.RECOGNIZED;
1074             }
1075         }
1076 
1077         if (propertyId.startsWith(Constants.JAXP_PROPERTY_PREFIX)) {
1078             final int suffixLength = propertyId.length() - Constants.JAXP_PROPERTY_PREFIX.length();
1079 
1080             if (suffixLength == Constants.SCHEMA_SOURCE.length() &&
1081                 propertyId.endsWith(Constants.SCHEMA_SOURCE)) {
1082                 return PropertyState.RECOGNIZED;
1083             }
1084         }
1085 
1086         // special cases
1087         if (propertyId.startsWith(Constants.SAX_PROPERTY_PREFIX)) {
1088             final int suffixLength = propertyId.length() - Constants.SAX_PROPERTY_PREFIX.length();
1089 
1090             //
1091             // http://xml.org/sax/properties/xml-string
1092             // Value type: String
1093             // Access: read-only
1094             //   Get the literal string of characters associated with the
1095             //   current event.  If the parser recognises and supports this
1096             //   property but is not currently parsing text, it should return
1097             //   null (this is a good way to check for availability before the
1098             //   parse begins).
1099             //
1100             if (suffixLength == Constants.XML_STRING_PROPERTY.length() &&
1101                 propertyId.endsWith(Constants.XML_STRING_PROPERTY)) {
1102                 // REVISIT - we should probably ask xml-dev for a precise
1103                 // definition of what this is actually supposed to return, and
1104                 // in exactly which circumstances.
1105                 return PropertyState.NOT_SUPPORTED;
1106             }
1107         }
1108 
1109         //
1110         // Not recognized
1111         //
1112 
1113         return super.checkProperty(propertyId);
1114 
1115     } // checkProperty(String)
1116 
1117 
1118     /**
1119      * Adds a component to the parser configuration. This method will
1120      * also add all of the component's recognized features and properties
1121      * to the list of default recognized features and properties.
1122      *
1123      * @param component The component to add.
1124      */
1125     protected void addComponent(XMLComponent component) {
1126 
1127         // don't add a component more than once
1128         if (fComponents.contains(component)) {
1129             return;
1130         }
1131         fComponents.add(component);
1132         addRecognizedParamsAndSetDefaults(component);
1133 
1134     } // addComponent(XMLComponent)
1135 
1136     /**
1137      * Adds common component to the parser configuration. This method will
1138      * also add all of the component's recognized features and properties
1139      * to the list of default recognized features and properties.
1140      *
1141      * @param component The component to add.
1142      */
1143     protected void addCommonComponent(XMLComponent component) {
1144 
1145         // don't add a component more than once
1146         if (fCommonComponents.contains(component)) {
1147             return;
1148         }
1149         fCommonComponents.add(component);
1150         addRecognizedParamsAndSetDefaults(component);
1151 
1152     } // addCommonComponent(XMLComponent)
1153 
1154     /**
1155      * Adds an XML 1.1 component to the parser configuration. This method will
1156      * also add all of the component's recognized features and properties
1157      * to the list of default recognized features and properties.
1158      *
1159      * @param component The component to add.
1160      */
1161     protected void addXML11Component(XMLComponent component) {
1162 
1163         // don't add a component more than once
1164         if (fXML11Components.contains(component)) {
1165             return;
1166         }
1167         fXML11Components.add(component);
1168         addRecognizedParamsAndSetDefaults(component);
1169 
1170     } // addXML11Component(XMLComponent)
1171 
1172     /**
1173      * Adds all of the component's recognized features and properties
1174      * to the list of default recognized features and properties, and
1175      * sets default values on the configuration for features and
1176      * properties which were previously absent from the configuration.
1177      *
1178      * @param component The component whose recognized features
1179      * and properties will be added to the configuration
1180      */
1181     protected void addRecognizedParamsAndSetDefaults(XMLComponent component) {
1182 
1183         // register component's recognized features
1184         String[] recognizedFeatures = component.getRecognizedFeatures();
1185         addRecognizedFeatures(recognizedFeatures);
1186 
1187         // register component's recognized properties
1188         String[] recognizedProperties = component.getRecognizedProperties();
1189         addRecognizedProperties(recognizedProperties);
1190 
1191         // set default values
1192         if (recognizedFeatures != null) {
1193             for (int i = 0; i < recognizedFeatures.length; ++i) {
1194                 String featureId = recognizedFeatures[i];
1195                 Boolean state = component.getFeatureDefault(featureId);
1196                 if (state != null) {
1197                     // Do not overwrite values already set on the configuration.
1198                     if (!fFeatures.containsKey(featureId)) {
1199                         fFeatures.put(featureId, state);
1200                         // For newly added components who recognize this feature
1201                         // but did not offer a default value, we need to make
1202                         // sure these components will get an opportunity to read
1203                         // the value before parsing begins.
1204                         fConfigUpdated = true;
1205                     }
1206                 }
1207             }
1208         }
1209         if (recognizedProperties != null) {
1210             for (int i = 0; i < recognizedProperties.length; ++i) {
1211                 String propertyId = recognizedProperties[i];
1212                 Object value = component.getPropertyDefault(propertyId);
1213                 if (value != null) {
1214                     // Do not overwrite values already set on the configuration.
1215                     if (!fProperties.containsKey(propertyId)) {
1216                         fProperties.put(propertyId, value);
1217                         // For newly added components who recognize this property
1218                         // but did not offer a default value, we need to make
1219                         // sure these components will get an opportunity to read
1220                         // the value before parsing begins.
1221                         fConfigUpdated = true;
1222                     }
1223                 }
1224             }
1225         }
1226     }
1227 
1228     private void initXML11Components() {
1229         if (!f11Initialized) {
1230 
1231             // create datatype factory
1232             fXML11DatatypeFactory = DTDDVFactory.getInstance(XML11_DATATYPE_VALIDATOR_FACTORY);
1233 
1234             // setup XML 1.1 DTD pipeline
1235             fXML11DTDScanner = new XML11DTDScannerImpl();
1236             addXML11Component(fXML11DTDScanner);
1237 
1238             // setup XML 1.1. document pipeline - namespace aware
1239             fXML11NSDocScanner = new XML11NSDocumentScannerImpl();
1240             addXML11Component(fXML11NSDocScanner);
1241 
1242             f11Initialized = true;
1243         }
1244     }
1245 
1246 } // class XML11NonValidatingConfiguration