Browse Source

Xalan1 prolly wont be supported in next Ant

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270988 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
93db46be11
2 changed files with 0 additions and 120 deletions
  1. +0
    -6
      proposal/myrmidon/src/java/org/apache/antlib/xml/XSLTProcess.java
  2. +0
    -114
      proposal/myrmidon/src/java/org/apache/antlib/xml/XalanLiaison.java

+ 0
- 6
proposal/myrmidon/src/java/org/apache/antlib/xml/XSLTProcess.java View File

@@ -494,12 +494,6 @@ public class XSLTProcess
loadClass( "org.apache.tools.ant.taskdefs.optional.TraXLiaison" );
m_liaison = (XSLTLiaison)clazz.newInstance();
}
else if( proc.equals( "xalan" ) )
{
final Class clazz =
loadClass( "org.apache.tools.ant.taskdefs.optional.XalanLiaison" );
m_liaison = (XSLTLiaison)clazz.newInstance();
}
else
{
m_liaison = (XSLTLiaison)loadClass( proc ).newInstance();


+ 0
- 114
proposal/myrmidon/src/java/org/apache/antlib/xml/XalanLiaison.java View File

@@ -1,114 +0,0 @@
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.antlib.xml;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.myrmidon.api.TaskException;
import org.apache.xalan.xslt.XSLTInputSource;
import org.apache.xalan.xslt.XSLTProcessor;
import org.apache.xalan.xslt.XSLTProcessorFactory;
import org.apache.xalan.xslt.XSLTResultTarget;

/**
* Concrete liaison for Xalan 1.x API.
*
* @author <a href="mailto:rubys@us.ibm.com">Sam Ruby</a>
* @author <a href="mailto:sbailliez@apache.org">Stephane Bailliez</a>
*/
public class XalanLiaison
implements XSLTLiaison
{
private XSLTProcessor processor;
private File stylesheet;

public XalanLiaison()
throws Exception
{
processor = XSLTProcessorFactory.getProcessor();
}

public void setOutputtype( String type )
throws Exception
{
if( !type.equals( "xml" ) ) {
throw new TaskException( "Unsupported output type: " + type );
}
}

public void setStylesheet( File stylesheet )
throws Exception
{
this.stylesheet = stylesheet;
}

public void addParam( String name, String value )
{
processor.setStylesheetParam( name, value );
}

public void transform( File infile, File outfile )
throws Exception
{
FileInputStream fis = null;
FileOutputStream fos = null;
FileInputStream xslStream = null;
try
{
xslStream = new FileInputStream( stylesheet );
fis = new FileInputStream( infile );
fos = new FileOutputStream( outfile );
// systemid such as file:/// + getAbsolutePath() are considered
// invalid here...
XSLTInputSource xslSheet = new XSLTInputSource( xslStream );
xslSheet.setSystemId( stylesheet.getAbsolutePath() );
XSLTInputSource src = new XSLTInputSource( fis );
src.setSystemId( infile.getAbsolutePath() );
XSLTResultTarget res = new XSLTResultTarget( fos );
processor.process( src, xslSheet, res );
}
finally
{
// make sure to close all handles, otherwise the garbage
// collector will close them...whenever possible and
// Windows may complain about not being able to delete files.
try
{
if( xslStream != null )
{
xslStream.close();
}
}
catch( IOException ignored )
{
}
try
{
if( fis != null )
{
fis.close();
}
}
catch( IOException ignored )
{
}
try
{
if( fos != null )
{
fos.close();
}
}
catch( IOException ignored )
{
}
}
}
}//-- XalanLiaison

Loading…
Cancel
Save