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;
726 */
727 protected final class XMLDeclDriver
728 implements Driver {
729
730 //
731 // Driver methods
732 //
733
734
735 public int next() throws IOException, XNIException {
736
737 // next driver is prolog regardless of whether there
738 // is an XMLDecl in this document
739 setScannerState(SCANNER_STATE_PROLOG);
740 setDriver(fPrologDriver);
741
742 //System.out.println("fEntityScanner = " + fEntityScanner);
743 // scan XMLDecl
744 try {
745 if (fEntityScanner.skipString(XMLDECL)) {
746 if (fEntityScanner.peekChar() == ' ') {
747 fMarkupDepth++;
748 scanXMLDeclOrTextDecl(false);
749 } else {
750 // PI, reset position
751 fEntityManager.fCurrentEntity.position = 0;
752 }
753 }
754
755 //START_OF_THE_DOCUMENT
756 fEntityManager.fCurrentEntity.mayReadChunks = true;
757 return XMLEvent.START_DOCUMENT;
758
759 }
760
761 // premature end of file
762 catch (EOFException e) {
763 reportFatalError("PrematureEOF", null);
764 return -1;
765 //throw e;
766 }
|
1 /*
2 * Copyright (c) 2003, 2017, 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;
726 */
727 protected final class XMLDeclDriver
728 implements Driver {
729
730 //
731 // Driver methods
732 //
733
734
735 public int next() throws IOException, XNIException {
736
737 // next driver is prolog regardless of whether there
738 // is an XMLDecl in this document
739 setScannerState(SCANNER_STATE_PROLOG);
740 setDriver(fPrologDriver);
741
742 //System.out.println("fEntityScanner = " + fEntityScanner);
743 // scan XMLDecl
744 try {
745 if (fEntityScanner.skipString(XMLDECL)) {
746 if (XMLChar.isSpace(fEntityScanner.peekChar())) {
747 fMarkupDepth++;
748 scanXMLDeclOrTextDecl(false);
749 } else {
750 // PI, reset position
751 fEntityManager.fCurrentEntity.position = 0;
752 }
753 }
754
755 //START_OF_THE_DOCUMENT
756 fEntityManager.fCurrentEntity.mayReadChunks = true;
757 return XMLEvent.START_DOCUMENT;
758
759 }
760
761 // premature end of file
762 catch (EOFException e) {
763 reportFatalError("PrematureEOF", null);
764 return -1;
765 //throw e;
766 }
|