santiagopg    2002/12/03 07:34:55

  Modified:    java/samples/CompiledServlet CompileServlet.java
                        TransformServlet.java
  Log:
  Updated sample to use non-deprecated API.
  
  Revision  Changes    Path
  1.3       +1 -2      
xml-xalan/java/samples/CompiledServlet/CompileServlet.java
  
  Index: CompileServlet.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/samples/CompiledServlet/CompileServlet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CompileServlet.java       13 Jul 2001 10:36:08 -0000      1.2
  +++ CompileServlet.java       3 Dec 2002 15:34:55 -0000       1.3
  @@ -72,7 +72,6 @@
   
   import org.apache.xalan.xsltc.compiler.*;
   import org.apache.xalan.xsltc.compiler.util.*;
  -import org.apache.xalan.xsltc.util.getopt.*;
   
   public class CompileServlet extends HttpServlet {
   
  
  
  
  1.2       +11 -6     
xml-xalan/java/samples/CompiledServlet/TransformServlet.java
  
  Index: TransformServlet.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/samples/CompiledServlet/TransformServlet.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TransformServlet.java     17 May 2001 15:36:40 -0000      1.1
  +++ TransformServlet.java     3 Dec 2002 15:34:55 -0000       1.2
  @@ -71,7 +71,8 @@
   import org.xml.sax.*;
   
   import org.apache.xalan.xsltc.*;
  -import org.apache.xalan.xsltc.runtime.*;
  +import org.apache.xalan.xsltc.runtime.AbstractTranslet;
  +import org.apache.xalan.xsltc.runtime.output.*;
   import org.apache.xalan.xsltc.dom.*;
   
   /**
  @@ -132,13 +133,17 @@
                // Read input document from the DOM cache
                DOMImpl dom = cache.retrieveDocument(documentURI, 0, translet);
   
  -             // Initialize the output handler
  -             DefaultSAXOutputHandler saxHandler = 
  -                 new DefaultSAXOutputHandler(out);
  +             // Create output handler
  +             TransletOutputHandlerFactory tohFactory = 
  +                 TransletOutputHandlerFactory.newInstance();
  +             tohFactory.setOutputType(TransletOutputHandlerFactory.STREAM);
  +             tohFactory.setEncoding(translet._encoding);
  +             tohFactory.setOutputMethod(translet._method);
  +             tohFactory.setWriter(out);
   
                // Start the transformation
                final long start = System.currentTimeMillis();
  -             translet.transform(dom, new TextOutput(saxHandler));
  +             translet.transform(dom, tohFactory.getTransletOutputHandler());
                final long done = System.currentTimeMillis() - start;
                out.println("<!-- transformed by XSLTC in "+done+"msecs -->");
            }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to