You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by dl...@locus.apache.org on 2000/12/08 19:48:23 UTC

cvs commit: xml-xalan/java/samples/servlet ApplyXSLT.java ApplyXSLTListener.java

dleslie     00/12/08 10:48:23

  Modified:    java/samples/servlet ApplyXSLT.java ApplyXSLTListener.java
  Log:
  1. DefaultErrorHandler in a new package.
  2. Use tRAX to get output properties.
  
  Revision  Changes    Path
  1.13      +18 -21    xml-xalan/java/samples/servlet/ApplyXSLT.java
  
  Index: ApplyXSLT.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/samples/servlet/ApplyXSLT.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ApplyXSLT.java	2000/11/21 17:37:16	1.12
  +++ ApplyXSLT.java	2000/12/08 18:48:22	1.13
  @@ -1,5 +1,5 @@
   /*****************************************************************************************************
  - * $Id: ApplyXSLT.java,v 1.12 2000/11/21 17:37:16 dleslie Exp $
  + * $Id: ApplyXSLT.java,v 1.13 2000/12/08 18:48:22 dleslie Exp $
    *
    * Copyright (c) 1998-1999 Lotus Corporation, Inc. All Rights Reserved.
    *				This software is provided without a warranty of any kind.
  @@ -15,10 +15,10 @@
   import java.net.URL;
   import java.net.MalformedURLException;
   import java.net.URLConnection;
  +import javax.xml.transform.OutputKeys;
   
   import org.apache.xalan.templates.Constants;
   import org.apache.xalan.templates.StylesheetRoot;
  -import org.apache.xalan.templates.OutputFormatExtended;
   // SAX2 Imports
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
  @@ -475,28 +475,25 @@
      */
     public String getContentType(Templates templates)
     {
  -	StylesheetRoot xslSourceRoot = (StylesheetRoot)templates;
  -	OutputFormatExtended of = xslSourceRoot.getOutput();
  -  if (null==of)
  -    of = new OutputFormatExtended();
  -	String encoding = of.getEncoding();
  -	String media = of.getMediaType();
  -	if (media != null)
  -	{
  +    Properties oprops = templates.getOutputProperties();
  +    String encoding = oprops.getProperty(OutputKeys.ENCODING);  
  +	  String media = oprops.getProperty(OutputKeys.MEDIA_TYPE);
  +	  if (media != null)
  +	  {
         if (encoding != null)
           return media + "; charset=" + encoding;
         return media;
  -	}
  -	else
  -	{
  -	  String method = of.getMethod();
  -	  if (method.equals("html"))
  -		  return "text/html";
  -	  else if (method.equals("text"))
  -		  return "text/plain";
  -	  else 
  -		  return "text/xml";
  -	}
  +	  }
  +	  else
  +	  {
  +	    String method = oprops.getProperty(OutputKeys.METHOD);
  +	    if (method.equals("html"))
  +		    return "text/html";
  +	    else if (method.equals("text"))
  +		    return "text/plain";
  +	    else 
  +		    return "text/xml";
  +	  }
     }
   
     /**
  
  
  
  1.4       +2 -2      xml-xalan/java/samples/servlet/ApplyXSLTListener.java
  
  Index: ApplyXSLTListener.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/samples/servlet/ApplyXSLTListener.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ApplyXSLTListener.java	2000/11/16 16:51:10	1.3
  +++ ApplyXSLTListener.java	2000/12/08 18:48:23	1.4
  @@ -1,5 +1,5 @@
   /*****************************************************************************************************
  - * $Id: ApplyXSLTListener.java,v 1.3 2000/11/16 16:51:10 dleslie Exp $
  + * $Id: ApplyXSLTListener.java,v 1.4 2000/12/08 18:48:23 dleslie Exp $
    *
    * Copyright (c) 1998-1999 Lotus Corporation, Inc. All Rights Reserved.
    *				This software is provided without a warranty of any kind.
  @@ -10,7 +10,7 @@
   
   import java.io.*;
   import org.xml.sax.*;
  -import org.apache.xalan.utils.DefaultErrorHandler;
  +import org.apache.xml.utils.DefaultErrorHandler;
   
   /*****************************************************************************************************
    * ApplyXSLTListener provides a buffered listener essential for capturing, and then subsequently