1 /* 2 * reserved comment block 3 * DO NOT REMOVE OR ALTER! 4 */ 5 /* 6 * Copyright 2004 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.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.Status; 46 import com.sun.org.apache.xerces.internal.util.SymbolTable; 47 import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler; 48 import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler; 49 import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler; 50 import com.sun.org.apache.xerces.internal.xni.XMLLocator; 51 import com.sun.org.apache.xerces.internal.xni.XNIException; 52 import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool; 53 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent; 54 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager; 55 import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; 56 import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner; 57 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner; 58 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource; 59 import com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver; 60 import com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler; 61 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; 62 import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration; 63 64 /** 65 * This class is the non vlaidating parser configuration 669 if (PRINT_EXCEPTION_STACK_TRACE) 670 ex.printStackTrace(); 671 throw ex; 672 } catch (IOException ex) { 673 if (PRINT_EXCEPTION_STACK_TRACE) 674 ex.printStackTrace(); 675 throw ex; 676 } catch (RuntimeException ex) { 677 if (PRINT_EXCEPTION_STACK_TRACE) 678 ex.printStackTrace(); 679 throw ex; 680 } catch (Exception ex) { 681 if (PRINT_EXCEPTION_STACK_TRACE) 682 ex.printStackTrace(); 683 throw new XNIException(ex); 684 } 685 686 } // parse(boolean):boolean 687 688 /** 689 * Returns the state of a feature. 690 * 691 * @param featureId The feature identifier. 692 * @return true if the feature is supported 693 * 694 * @throws XMLConfigurationException Thrown for configuration error. 695 * In general, components should 696 * only throw this exception if 697 * it is <strong>really</strong> 698 * a critical error. 699 */ 700 public FeatureState getFeatureState(String featureId) 701 throws XMLConfigurationException { 702 // make this feature special 703 if (featureId.equals(PARSER_SETTINGS)){ 704 return FeatureState.is(fConfigUpdated); 705 } 706 return super.getFeatureState(featureId); 707 708 } // getFeature(String):boolean | 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 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 |