/*
 * 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.bind.marshal;

import com.sun.japex.TestCase;
import javax.xml.stream.XMLOutputFactory;


public class JAXBSunSJSXPStAXDriver extends BaseMarshallerDriver {
    XMLOutputFactory _factory;

    public void initializeDriver() {
        super.initializeDriver();
        
        try {
            _factory = new com.sun.xml.stream.ZephyrWriterFactory();
        } 
        catch (Exception e) {
            e.printStackTrace();
        }
    }
    
    public void run(TestCase testCase) {
        try {
            _outputStream.reset();
            _marshaller.marshal(_bean, _factory.createXMLStreamWriter(_outputStream));
        } 
        catch (Exception e) {
            e.printStackTrace();
        }
    }    
}

@@ -1627,19 +1627,17 @@
 marshal;
-%0D%0A%0D
+%0A
 %0Aimport 
@@ -1659,17 +1659,16 @@
 estCase;
-%0D
 %0Aimport 
@@ -1705,13 +1705,51 @@
 ory;
-%0D%0A%0D%0A%0D
+%0Aimport javax.xml.stream.XMLStreamWriter;%0A%0A
 %0Apub
@@ -1811,17 +1811,16 @@
 Driver %7B
-%0D
 %0A    XML
@@ -1846,11 +1846,9 @@
 ory;
-%0D%0A%0D
+%0A
 %0A   
@@ -1880,17 +1880,16 @@
 iver() %7B
-%0D
 %0A       
@@ -1914,17 +1914,16 @@
 river();
-%0D
 %0A       
@@ -1919,25 +1919,24 @@
 ();%0A        
-%0D
 %0A        try
@@ -1929,33 +1929,32 @@
   %0A        try %7B
-%0D
 %0A            _fa
@@ -2006,17 +2006,16 @@
 ctory();
-%0D
 %0A       
@@ -2009,33 +2009,32 @@
 ry();%0A        %7D 
-%0D
 %0A        catch (
@@ -2039,33 +2039,32 @@
  (Exception e) %7B
-%0D
 %0A            e.p
@@ -2072,33 +2072,32 @@
 intStackTrace();
-%0D
 %0A        %7D%0D%0A    
@@ -2094,22 +2094,19 @@
    %7D
-%0D
 %0A    %7D
-%0D
 %0A    
-%0D
 %0A   
@@ -2138,25 +2138,24 @@
  testCase) %7B
-%0D
 %0A        try
@@ -2156,17 +2156,16 @@
    try %7B
-%0D
 %0A       
@@ -2191,17 +2191,16 @@
 reset();
-%0D
 %0A       
@@ -2208,34 +2208,32 @@
     
-_marshaller.marshal(_bean,
+XMLStreamWriter writer =
  _fa
@@ -2274,19 +2274,93 @@
 tStream)
+;%0A            _marshaller.marshal(_bean, writer);%0A            writer.close(
 );
-%0D
 %0A       
@@ -2362,17 +2362,16 @@
       %7D 
-%0D
 %0A       
@@ -2392,17 +2392,16 @@
 ion e) %7B
-%0D
 %0A       
@@ -2425,17 +2425,16 @@
 Trace();
-%0D
 %0A       
@@ -2435,17 +2435,16 @@
        %7D
-%0D
 %0A    %7D  
@@ -2449,9 +2449,7 @@
     
-%0D
 %0A%7D
-%0D
 %0A

Call XMLStreamWriter.close after writing the document