src/java.xml/share/classes/javax/xml/parsers/SAXParser.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 535      * @return
 536      *      the return value of
 537      *      the {@link SAXParserFactory#isXIncludeAware()}
 538      *      when this parser was created from factory.
 539      *
 540      * @throws UnsupportedOperationException When implementation does not
 541      *   override this method
 542      *
 543      * @since 1.5
 544      *
 545      * @see SAXParserFactory#setXIncludeAware(boolean)
 546      */
 547     public boolean isXIncludeAware() {
 548         throw new UnsupportedOperationException(
 549             "This parser does not support specification \""
 550             + this.getClass().getPackage().getSpecificationTitle()
 551             + "\" version \""
 552             + this.getClass().getPackage().getSpecificationVersion()
 553             + "\""
 554             );

















































 555     }
 556 }
   1 /*
   2  * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 535      * @return
 536      *      the return value of
 537      *      the {@link SAXParserFactory#isXIncludeAware()}
 538      *      when this parser was created from factory.
 539      *
 540      * @throws UnsupportedOperationException When implementation does not
 541      *   override this method
 542      *
 543      * @since 1.5
 544      *
 545      * @see SAXParserFactory#setXIncludeAware(boolean)
 546      */
 547     public boolean isXIncludeAware() {
 548         throw new UnsupportedOperationException(
 549             "This parser does not support specification \""
 550             + this.getClass().getPackage().getSpecificationTitle()
 551             + "\" version \""
 552             + this.getClass().getPackage().getSpecificationVersion()
 553             + "\""
 554             );
 555     }
 556 
 557 
 558     /**
 559      * Stops the parsing process.
 560      * <p>
 561      * This method can be called anywhere from any event method of a SAX
 562      * handler. Once called, it does not terminate the parsing process
 563      * immediately. Instead, it will continue finishing and returning the
 564      * current event, and marking the state before it stops parsing. The
 565      * parsing state is maintained after the process is stopped.
 566      * <p>
 567      * The event from which the method is called is considered parsed. In case
 568      * the parsing process is subsequently resumed, it will start at the next
 569      * event.
 570      *
 571      * @implSpec
 572      * The method in the {@code javax.xml.parsers} API does nothing and returns
 573      * false by default. Implementations that implement this method may choose
 574      * to continue to a state for possible resumption of the operation. It is
 575      * recommended that the current event be returned before terminating
 576      * the parsing process.
 577      * <p>
 578      * The method shall return true once it has notified the parser to stop
 579      * parsing.
 580      *
 581      * @return true if the parsing process can be stopped, false otherwise
 582      */
 583     public boolean stop() {
 584         return false;
 585     }
 586 
 587     /**
 588      * Resumes the parsing process that has been stopped by the {@link #stop()}
 589      * method. The method will simply return if parsing is not stopped.
 590      *
 591      * @implSpec
 592      * The method in the {@code javax.xml.parsers} API does nothing and returns
 593      * false by default. Implementations that implement this method shall
 594      * check the state to determine whether the parsing process can be resumed.
 595      * It shall return true after it restarted the parsing regardless of what
 596      * may happen in the rest of the parsing process, that is, the return value
 597      * only indicates that the parsing can be and has been resumed.
 598      *
 599      * @return true if the parsing process is resumed successfully, false
 600      * otherwise
 601      */
 602     public boolean resume() {
 603         return false;
 604     }
 605 }