/*
 * Copyright, 2004-2005 Sun Microsystems, Inc. All Rights Reserved.
 *
 * Software is licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may
 * obtain a copy of the License at:
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations.
 *
 *    Sun supports and benefits from the global community of open source
 * developers, and thanks the community for its important contributions and
 * open standards-based technology, which Sun has adopted into many of its
 * products.
 *
 *    Please note that portions of Software may be provided with notices and
 * open source licenses from such communities and third parties that govern the
 * use of those portions, and any licenses granted hereunder do not alter any
 * rights and obligations you may have under such open source licenses,
 * however, the disclaimer of warranty and limitation of liability provisions
 * in this License will apply to all Software in this distribution.
 *
 *    You acknowledge that the Software is not designed, licensed or intended
 * for use in the design, construction, operation or maintenance of any nuclear
 * facility.
 *
 * Apache License
 * Version 2.0, January 2004
 * http://www.apache.org/licenses/
 *
 */

package com.sun.japex.jdsl.xml.parsing.stax;

import com.sun.japex.TestCase;
import com.sun.japex.jdsl.xml.BaseParserDriver;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;


public class SunSJSXPStAXDriver extends BaseParserDriver {    
    XMLInputFactory _factory;
    XMLStreamReader _reader;
    
    public void initializeDriver() {
        super.initializeDriver();
        
        try {
            _factory = new com.sun.xml.stream.ZephyrParserFactory();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }   
        
    public void run(TestCase testCase) {
        try {
            _inputStream.reset();
            _reader = _factory.createXMLStreamReader(_inputStream);
            while (_reader.hasNext()) {
                _reader.next();
            }
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }    
}

@@ -1,10 +1,11 @@
 /*
+%0D
 %0A * Copy
@@ -64,19 +64,21 @@
 eserved.
+%0D
 %0A *
+%0D
 %0A * Soft
@@ -148,16 +148,17 @@
 cense%22);
+%0D
 %0A * you 
@@ -225,16 +225,17 @@
  You may
+%0D
 %0A * obta
@@ -262,19 +262,21 @@
 ense at:
+%0D
 %0A *
+%0D
 %0A *     
@@ -320,19 +320,21 @@
 ENSE-2.0
+%0D
 %0A *
+%0D
 %0A *    U
@@ -399,16 +399,17 @@
 software
+%0D
 %0A * dist
@@ -477,16 +477,17 @@
  WITHOUT
+%0D
 %0A * WARR
@@ -550,24 +550,25 @@
 ied. See the
+%0D
 %0A * License 
@@ -631,19 +631,21 @@
 tations.
+%0D
 %0A *
+%0D
 %0A *    S
@@ -709,16 +709,17 @@
 n source
+%0D
 %0A * deve
@@ -782,24 +782,25 @@
 ibutions and
+%0D
 %0A * open sta
@@ -862,16 +862,17 @@
 y of its
+%0D
 %0A * prod
@@ -876,19 +876,21 @@
 roducts.
+%0D
 %0A *
+%0D
 %0A *    P
@@ -958,16 +958,17 @@
 ices and
+%0D
 %0A * open
@@ -1039,16 +1039,17 @@
 vern the
+%0D
 %0A * use 
@@ -1118,16 +1118,17 @@
 lter any
+%0D
 %0A * righ
@@ -1191,16 +1191,17 @@
 icenses,
+%0D
 %0A * howe
@@ -1270,16 +1270,17 @@
 ovisions
+%0D
 %0A * in t
@@ -1339,19 +1339,21 @@
 ibution.
+%0D
 %0A *
+%0D
 %0A *    Y
@@ -1422,16 +1422,17 @@
 intended
+%0D
 %0A * for 
@@ -1503,16 +1503,17 @@
  nuclear
+%0D
 %0A * faci
@@ -1517,19 +1517,21 @@
 acility.
+%0D
 %0A *
+%0D
 %0A * Apac
@@ -1540,16 +1540,17 @@
  License
+%0D
 %0A * Vers
@@ -1570,16 +1570,17 @@
 ary 2004
+%0D
 %0A * http
@@ -1610,16 +1610,20 @@
 ses/
+%0D
 %0A *
+%0D
 %0A */
-%0A
+%0D%0A%0D
 %0Apac
@@ -2473,24 +2473,24 @@
 er.next();%0D%0A
-
             
@@ -2484,32 +2484,62 @@
 %0A            %7D%0D%0A
+            _reader.close();%0D%0A
         %7D%0D%0A     

Call XMLStreamReader.close() after parsing to ensure parser reuse.