Re: [xsl] xalan-j2 D7: StreamSource cannot be kept?

Subject: Re: [xsl] xalan-j2 D7: StreamSource cannot be kept?
From: Myriam_Midy@xxxxxxxxx
Date: Thu, 9 Aug 2001 16:51:45 -0400
I believe you can close it by calling :
StreamSource.getInputStream().close() or
SteamSource.getReader().close() depending on wether you have a reader or
inputStream available.

But Scott seams to think that there is a bug in Xalan??

Myriam


                                                                                                    
                    "Robert Koberg"                                                                 
                    <rob@xxxxxxxxxx>                  To:     <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>     
                    Sent by:                          cc:     (bcc: Myriam Midy/CAM/Lotus)          
                    owner-xsl-list@xxxxxxxxxxxx       Subject:     Re: [xsl] xalan-j2 D7:           
                    rytech.com                         StreamSource cannot be kept?                 
                                                                                                    
                                                                                                    
                    08/09/01 03:43 PM                                                               
                    Please respond to xsl-list                                                      
                                                                                                    
                                                                                                    




I am looking but I don't see how to close the StreamSource.  I am setting
it
to null but that does not help.  In the examples I always see something
like:

Templates templates = tfactory.newTemplates(new StreamSource(xslID));

I assume that by doing it this way the StreamSource gets closed
automatically?  How would I close the stream if I created the "new
StreamSource(xsl)" somewhere else?

thanks for the help,
-Rob



----- Original Message -----
From: <Myriam_Midy@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, August 09, 2001 12:03 PM
Subject: Re: [xsl] xalan-j2 D7: StreamSource cannot be kept?


>
> Robert,
> Users are responsible for closing streams in Xalan. I think that is what
> you need to do before reusing the stream. If you don't, the next time you
> try to read it, you will get an IO error. I don't think cloning will help
> you in this situation.
>
> Myriam
>
>
>
>                     "Robert Koberg"
>                     <rob@xxxxxxxxxx>                  To:
<xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
>                     Sent by:                          cc:     (bcc:
Myriam
Midy/CAM/Lotus)
>                     owner-xsl-list@xxxxxxxxxxxx       Subject:     Re:
[xsl] xalan-j2 D7:
>                     rytech.com                         StreamSource
cannot
be kept?
>
>
>                     08/09/01 02:18 PM
>                     Please respond to xsl-list
>
>
>
>
>
>
> Ahh... OK, is there some way to make a copy to preserve the original? I
> have
> tried to clone the object holding the StreamSource, like so:
>
> public Object clone() {
>       SiteManager site = null;
>       try {
>          site = (SiteManager) super.clone();
>       } catch (CloneNotSupportedException e) {}
>       return site;
>    }
>
> It works with a clone the first time, but fails to create any other
clones.
>
> Any ideas on how to workaround this?
>
>
> ----- Original Message -----
> From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> Sent: Thursday, August 09, 2001 10:13 AM
> Subject: RE: [xsl] xalan-j2 D7: StreamSource cannot be kept?
>
>
> > The JAXP 1.1 spec is rather remiss in that it doesn't say which kinds
of
> > Source object are consumed by supplying them to a transformation. But I
> > think it's reasonable to assume that a StreamSource or SAXSource can
only
> be
> > used once.
> >
> > Mike Kay
> > Software AG
> >
> > > -----Original Message-----
> > > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of
> > > Robert Koberg
> > > Sent: 09 August 2001 15:50
> > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > > Subject: [xsl] xalan-j2 D7: StreamSource cannot be kept?
> > >
> > >
> > > Hi, I was hoping someone could help me with this problem.
> > >
> > > I keep the XSL and XML StreamSource's for my webapp in a
> > > couple of java
> > > objects on a j2ee compliant servlet container. When I want to
> > > transform a
> > > page I request the appropriate combination of StreamSource's
> > > (see More info
> > > on the backend below).  Everything works fine THE FIRST TIME.
> > >  If I use the
> > > browser back button and perform the exact same action to get
> > > to the same
> > > page that origanlly worked, it produces a
> > > TransformerException saying that
> > > it cannot find the file specified (but it's already setup as
> > > a stream...).
> > > Nothing has changed. If I check the StreamSource's reference
> > > ID, it has not
> > > changed.  Has something changed the stream itself? Is there
> > > some way to see
> > > the stream?
> > >
> > > More info on the backend:
> > > -----------------------------------
> > > I was hoping (don't know if it is a good thing to do or
> > > not...?) to create a
> > > "database" of StreamSources - with an instance of a Page
> > > Object containing
> > > the StreamSource for an XML.  A Site Object contains the XSL
> > > StreamSource's.
> > > To get a page I access the appropriate instances and get the
> > > XSL and XML
> > > StreamSources. Can anybody help or give me some advice? Is this a
good
> > > strategy for producing a fast, dynamic site?
> > >
> > > Thanks,
> > > Rob
> > >
> > >
> > >  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> > >
> >
> >
> >  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> >
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>
>
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list






 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread