< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java

Print this page


   1 /*
   2  * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.

   3  */
   4 
   5 /*
   6  * Licensed to the Apache Software Foundation (ASF) under one or more
   7  * contributor license agreements.  See the NOTICE file distributed with
   8  * this work for additional information regarding copyright ownership.
   9  * The ASF licenses this file to You under the Apache License, Version 2.0
  10  * (the "License"); you may not use this file except in compliance with
  11  * the License.  You may obtain a copy of the License at
  12  *
  13  *     http://www.apache.org/licenses/LICENSE-2.0
  14  *
  15  * Unless required by applicable law or agreed to in writing, software
  16  * distributed under the License is distributed on an "AS IS" BASIS,
  17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18  * See the License for the specific language governing permissions and
  19  * limitations under the License.
  20  */
  21 
  22 package com.sun.org.apache.xerces.internal.impl;
  23 
  24 import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;


 316      *                 of the document and return. A scanner instance is
 317      *                 permitted to completely scan a document if it does
 318      *                 not support this "pull" scanning model.
 319      * @param standalone True if the document was specified as standalone.
 320      *                   This value is important for verifying certain
 321      *                   well-formedness constraints.
 322      * @param hasExternalDTD True if the document has an external DTD.
 323      *                       This allows the scanner to properly notify
 324      *                       the handler of the end of the DTD in the
 325      *                       absence of an external subset.
 326      *
 327      * @return True if there is more to scan, false otherwise.
 328      */
 329     public boolean scanDTDInternalSubset(boolean complete, boolean standalone,
 330     boolean hasExternalSubset)
 331     throws IOException, XNIException {
 332         // reset entity scanner
 333         //xxx:stax getText() is supposed to return only DTD internal subset
 334         //shouldn't we record position here before we go ahead ??
 335 
 336         fEntityScanner = (XMLEntityScanner)fEntityManager.getEntityScanner();
 337         fEntityManager.setEntityHandler(this);
 338         fStandalone = standalone;
 339         //System.out.println("state"+fScannerState);
 340         if (fScannerState == SCANNER_STATE_TEXT_DECL) {
 341             // call handler
 342             if (fDTDHandler != null) {
 343                 fDTDHandler.startDTD(fEntityScanner, null);
 344                 fStartDTDCalled = true;
 345             }
 346 
 347             if (nonValidatingMode){
 348                 fStartDTDCalled = true;
 349                 nvGrammarInfo.startDTD(fEntityScanner,null);
 350             }
 351             // set starting state for internal subset
 352             setScannerState(SCANNER_STATE_MARKUP_DECL);
 353         }
 354         // keep dispatching "events"
 355         do {
 356             if (!scanDecls(complete)) {


 426     public void reset() {
 427         super.reset();
 428         init();
 429 
 430     }
 431 
 432     public void reset(PropertyManager props) {
 433         setPropertyManager(props);
 434         super.reset(props);
 435         init() ;
 436         nonValidatingMode = true;
 437         //Revisit : Create new grammar until we implement GrammarPool.
 438         nvGrammarInfo = new DTDGrammar(fSymbolTable);
 439     }
 440     /**
 441      * Returns a list of feature identifiers that are recognized by
 442      * this component. This method may return null if no features
 443      * are recognized by this component.
 444      */
 445     public String[] getRecognizedFeatures() {
 446         return (String[])(RECOGNIZED_FEATURES.clone());
 447     } // getRecognizedFeatures():String[]
 448 
 449     /**
 450      * Returns a list of property identifiers that are recognized by
 451      * this component. This method may return null if no properties
 452      * are recognized by this component.
 453      */
 454     public String[] getRecognizedProperties() {
 455         return (String[])(RECOGNIZED_PROPERTIES.clone());
 456     } // getRecognizedProperties():String[]
 457 
 458     /**
 459      * Returns the default state for a feature, or null if this
 460      * component does not want to report a default value for this
 461      * feature.
 462      *
 463      * @param featureId The feature identifier.
 464      *
 465      * @since Xerces 2.2.0
 466      */
 467     public Boolean getFeatureDefault(String featureId) {
 468         for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) {
 469             if (RECOGNIZED_FEATURES[i].equals(featureId)) {
 470                 return FEATURE_DEFAULTS[i];
 471             }
 472         }
 473         return null;
 474     } // getFeatureDefault(String):Boolean
 475 


   1 /*
   2  * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * @LastModified: Nov 2017
   4  */

   5 /*
   6  * Licensed to the Apache Software Foundation (ASF) under one or more
   7  * contributor license agreements.  See the NOTICE file distributed with
   8  * this work for additional information regarding copyright ownership.
   9  * The ASF licenses this file to You under the Apache License, Version 2.0
  10  * (the "License"); you may not use this file except in compliance with
  11  * the License.  You may obtain a copy of the License at
  12  *
  13  *     http://www.apache.org/licenses/LICENSE-2.0
  14  *
  15  * Unless required by applicable law or agreed to in writing, software
  16  * distributed under the License is distributed on an "AS IS" BASIS,
  17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18  * See the License for the specific language governing permissions and
  19  * limitations under the License.
  20  */
  21 
  22 package com.sun.org.apache.xerces.internal.impl;
  23 
  24 import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;


 316      *                 of the document and return. A scanner instance is
 317      *                 permitted to completely scan a document if it does
 318      *                 not support this "pull" scanning model.
 319      * @param standalone True if the document was specified as standalone.
 320      *                   This value is important for verifying certain
 321      *                   well-formedness constraints.
 322      * @param hasExternalDTD True if the document has an external DTD.
 323      *                       This allows the scanner to properly notify
 324      *                       the handler of the end of the DTD in the
 325      *                       absence of an external subset.
 326      *
 327      * @return True if there is more to scan, false otherwise.
 328      */
 329     public boolean scanDTDInternalSubset(boolean complete, boolean standalone,
 330     boolean hasExternalSubset)
 331     throws IOException, XNIException {
 332         // reset entity scanner
 333         //xxx:stax getText() is supposed to return only DTD internal subset
 334         //shouldn't we record position here before we go ahead ??
 335 
 336         fEntityScanner = fEntityManager.getEntityScanner();
 337         fEntityManager.setEntityHandler(this);
 338         fStandalone = standalone;
 339         //System.out.println("state"+fScannerState);
 340         if (fScannerState == SCANNER_STATE_TEXT_DECL) {
 341             // call handler
 342             if (fDTDHandler != null) {
 343                 fDTDHandler.startDTD(fEntityScanner, null);
 344                 fStartDTDCalled = true;
 345             }
 346 
 347             if (nonValidatingMode){
 348                 fStartDTDCalled = true;
 349                 nvGrammarInfo.startDTD(fEntityScanner,null);
 350             }
 351             // set starting state for internal subset
 352             setScannerState(SCANNER_STATE_MARKUP_DECL);
 353         }
 354         // keep dispatching "events"
 355         do {
 356             if (!scanDecls(complete)) {


 426     public void reset() {
 427         super.reset();
 428         init();
 429 
 430     }
 431 
 432     public void reset(PropertyManager props) {
 433         setPropertyManager(props);
 434         super.reset(props);
 435         init() ;
 436         nonValidatingMode = true;
 437         //Revisit : Create new grammar until we implement GrammarPool.
 438         nvGrammarInfo = new DTDGrammar(fSymbolTable);
 439     }
 440     /**
 441      * Returns a list of feature identifiers that are recognized by
 442      * this component. This method may return null if no features
 443      * are recognized by this component.
 444      */
 445     public String[] getRecognizedFeatures() {
 446         return RECOGNIZED_FEATURES.clone();
 447     } // getRecognizedFeatures():String[]
 448 
 449     /**
 450      * Returns a list of property identifiers that are recognized by
 451      * this component. This method may return null if no properties
 452      * are recognized by this component.
 453      */
 454     public String[] getRecognizedProperties() {
 455         return RECOGNIZED_PROPERTIES.clone();
 456     } // getRecognizedProperties():String[]
 457 
 458     /**
 459      * Returns the default state for a feature, or null if this
 460      * component does not want to report a default value for this
 461      * feature.
 462      *
 463      * @param featureId The feature identifier.
 464      *
 465      * @since Xerces 2.2.0
 466      */
 467     public Boolean getFeatureDefault(String featureId) {
 468         for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) {
 469             if (RECOGNIZED_FEATURES[i].equals(featureId)) {
 470                 return FEATURE_DEFAULTS[i];
 471             }
 472         }
 473         return null;
 474     } // getFeatureDefault(String):Boolean
 475 


< prev index next >