commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml TransformTag.java
Date Thu, 24 Oct 2002 13:52:04 GMT
jstrachan    2002/10/24 06:52:04

  Modified:    jelly/src/java/org/apache/commons/jelly/tags/xml
                        TransformTag.java
  Log:
  Added support for File as an acceptable type of the xml and xslt parameters
  
  Revision  Changes    Path
  1.5       +12 -0     jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/TransformTag.java
  
  Index: TransformTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/TransformTag.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TransformTag.java	3 Oct 2002 18:14:44 -0000	1.4
  +++ TransformTag.java	24 Oct 2002 13:52:03 -0000	1.5
  @@ -61,11 +61,13 @@
    */
   package org.apache.commons.jelly.tags.xml;
   
  +import java.io.File;
   import java.io.IOException;
   import java.io.InputStream;
   import java.io.Reader;
   import java.io.StringReader;
   import java.io.StringWriter;
  +import java.net.MalformedURLException;
   import java.net.URL;
   import java.util.Iterator;
   import java.util.List;
  @@ -352,6 +354,16 @@
               else if (sourceObj instanceof URL) {
                   String uri = ((URL) sourceObj).toString();
                   xmlInputSource = new InputSource(context.getResourceAsStream(uri));
  +            }
  +            else if (sourceObj instanceof File) {
  +                try {
  +                    String uri = ((File) sourceObj).toURL().toString();
  +                    xmlInputSource = new InputSource(context.getResourceAsStream(uri));
  +                }
  +                catch (MalformedURLException e) {
  +                    throw new IllegalArgumentException(
  +                        "This should never occur. We should always be able to convert a
File to a URL" + e );
  +                }
               }
               else {
                   throw new IllegalArgumentException(
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message