src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java

Print this page


   1 /*
   2  * reserved comment block
   3  * DO NOT REMOVE OR ALTER!
   4  */
   5 /*
   6  * Copyright 2000-2005 The Apache Software Foundation.
   7  *
   8  * Licensed under the Apache License, Version 2.0 (the "License");
   9  * you may not use this file except in compliance with the License.
  10  * You may obtain a copy of the License at

  11  *
  12  *      http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 
  21 package com.sun.org.apache.xerces.internal.jaxp;
  22 
  23 import com.sun.org.apache.xerces.internal.impl.Constants;
  24 import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
  25 import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator;
  26 import com.sun.org.apache.xerces.internal.jaxp.validation.XSGrammarPoolContainer;
  27 import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
  28 import com.sun.org.apache.xerces.internal.util.Status;
  29 import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
  30 import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;


 328             xmlReader.setErrorHandler(dh);
 329             xmlReader.setDTDHandler(dh);
 330             xmlReader.setDocumentHandler(null);
 331         }
 332         xmlReader.parse(is);
 333     }
 334 
 335     public void parse(InputSource is, HandlerBase hb)
 336         throws SAXException, IOException {
 337         if (is == null) {
 338             throw new IllegalArgumentException();
 339         }
 340         if (hb != null) {
 341             xmlReader.setDocumentHandler(hb);
 342             xmlReader.setEntityResolver(hb);
 343             xmlReader.setErrorHandler(hb);
 344             xmlReader.setDTDHandler(hb);
 345             xmlReader.setContentHandler(null);
 346         }
 347         xmlReader.parse(is);










 348     }
 349 
 350     public Schema getSchema() {
 351         return grammar;
 352     }
 353 
 354     public void reset() {
 355         try {
 356             /** Restore initial values of features and properties. **/
 357             xmlReader.restoreInitState();
 358         }
 359         catch (SAXException exc) {
 360             // This should never happen. We only store recognized
 361             // features and properties in the hash maps. For now
 362             // just ignore it.
 363         }
 364         /** Restore various handlers. **/
 365         xmlReader.setContentHandler(null);
 366         xmlReader.setDTDHandler(null);
 367         if (xmlReader.getErrorHandler() != fInitErrorHandler) {


   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.jaxp;
  22 
  23 import com.sun.org.apache.xerces.internal.impl.Constants;
  24 import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
  25 import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator;
  26 import com.sun.org.apache.xerces.internal.jaxp.validation.XSGrammarPoolContainer;
  27 import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
  28 import com.sun.org.apache.xerces.internal.util.Status;
  29 import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
  30 import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;


 328             xmlReader.setErrorHandler(dh);
 329             xmlReader.setDTDHandler(dh);
 330             xmlReader.setDocumentHandler(null);
 331         }
 332         xmlReader.parse(is);
 333     }
 334 
 335     public void parse(InputSource is, HandlerBase hb)
 336         throws SAXException, IOException {
 337         if (is == null) {
 338             throw new IllegalArgumentException();
 339         }
 340         if (hb != null) {
 341             xmlReader.setDocumentHandler(hb);
 342             xmlReader.setEntityResolver(hb);
 343             xmlReader.setErrorHandler(hb);
 344             xmlReader.setDTDHandler(hb);
 345             xmlReader.setContentHandler(null);
 346         }
 347         xmlReader.parse(is);
 348     }
 349 
 350     @Override
 351     public boolean stop() {
 352         return xmlReader.stop();
 353     }
 354 
 355     @Override
 356     public boolean resume() {
 357         return xmlReader.resume();
 358     }
 359 
 360     public Schema getSchema() {
 361         return grammar;
 362     }
 363 
 364     public void reset() {
 365         try {
 366             /** Restore initial values of features and properties. **/
 367             xmlReader.restoreInitState();
 368         }
 369         catch (SAXException exc) {
 370             // This should never happen. We only store recognized
 371             // features and properties in the hash maps. For now
 372             // just ignore it.
 373         }
 374         /** Restore various handlers. **/
 375         xmlReader.setContentHandler(null);
 376         xmlReader.setDTDHandler(null);
 377         if (xmlReader.getErrorHandler() != fInitErrorHandler) {