< prev index next >

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

Print this page


   1 /*
   2  * Copyright (c) 2005, 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


 590             // else real error
 591             throw new XMLStreamException(ex.getMessage(), getLocation(), ex);
 592         } catch (XNIException ex) {
 593             throw new XMLStreamException(
 594                     ex.getMessage(),
 595                     getLocation(),
 596                     ex.getException());
 597         }
 598     } //next()
 599 
 600     private void switchToXML11Scanner() throws IOException{
 601 
 602         int oldEntityDepth = fScanner.fEntityDepth;
 603         com.sun.org.apache.xerces.internal.xni.NamespaceContext oldNamespaceContext = fScanner.fNamespaceContext;
 604 
 605         fScanner = new XML11NSDocumentScannerImpl();
 606 
 607         //get the new scanner state to old scanner's previous state
 608         fScanner.reset(fPropertyManager);
 609         fScanner.setPropertyManager(fPropertyManager);
 610         fEntityScanner = (XMLEntityScanner)fEntityManager.getEntityScanner()  ;

 611         fEntityManager.fCurrentEntity.mayReadChunks = true;
 612         fScanner.setScannerState(XMLEvent.START_DOCUMENT);
 613 
 614         fScanner.fEntityDepth = oldEntityDepth;
 615         fScanner.fNamespaceContext = oldNamespaceContext;
 616         fEventType = fScanner.next();
 617     }
 618 
 619 
 620 
 621     final static String getEventTypeString(int eventType) {
 622         switch (eventType){
 623             case XMLEvent.START_ELEMENT:
 624                 return "START_ELEMENT";
 625             case XMLEvent.END_ELEMENT:
 626                 return "END_ELEMENT";
 627             case XMLEvent.PROCESSING_INSTRUCTION:
 628                 return "PROCESSING_INSTRUCTION";
 629             case XMLEvent.CHARACTERS:
 630                 return "CHARACTERS";


   1 /*
   2  * Copyright (c) 2005, 2016, 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


 590             // else real error
 591             throw new XMLStreamException(ex.getMessage(), getLocation(), ex);
 592         } catch (XNIException ex) {
 593             throw new XMLStreamException(
 594                     ex.getMessage(),
 595                     getLocation(),
 596                     ex.getException());
 597         }
 598     } //next()
 599 
 600     private void switchToXML11Scanner() throws IOException{
 601 
 602         int oldEntityDepth = fScanner.fEntityDepth;
 603         com.sun.org.apache.xerces.internal.xni.NamespaceContext oldNamespaceContext = fScanner.fNamespaceContext;
 604 
 605         fScanner = new XML11NSDocumentScannerImpl();
 606 
 607         //get the new scanner state to old scanner's previous state
 608         fScanner.reset(fPropertyManager);
 609         fScanner.setPropertyManager(fPropertyManager);
 610         fEntityScanner = fEntityManager.getEntityScanner();
 611         fEntityScanner.registerListener(fScanner);
 612         fEntityManager.fCurrentEntity.mayReadChunks = true;
 613         fScanner.setScannerState(XMLEvent.START_DOCUMENT);
 614 
 615         fScanner.fEntityDepth = oldEntityDepth;
 616         fScanner.fNamespaceContext = oldNamespaceContext;
 617         fEventType = fScanner.next();
 618     }
 619 
 620 
 621 
 622     final static String getEventTypeString(int eventType) {
 623         switch (eventType){
 624             case XMLEvent.START_ELEMENT:
 625                 return "START_ELEMENT";
 626             case XMLEvent.END_ELEMENT:
 627                 return "END_ELEMENT";
 628             case XMLEvent.PROCESSING_INSTRUCTION:
 629                 return "PROCESSING_INSTRUCTION";
 630             case XMLEvent.CHARACTERS:
 631                 return "CHARACTERS";


< prev index next >