[xstream-user] Re: HOWTO: Using XSLT to convert XML attributes to elements

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[xstream-user] Re: HOWTO: Using XSLT to convert XML attributes to elements

Holger-3
Which class have I to use in the following case:

  InputStream resourceAsStream = Test.class.getResourceAsStream("test.xsl");

I tried some but the result is "resourceAsStream == null"

Which one should I use?


Reply | Threaded
Open this post in threaded view
|

RE: [xstream-user] Re: HOWTO: Using XSLT to convert XML attributes to elements

Jörg Schaible
Holger wrote on Tuesday, November 15, 2005 12:52 PM:

> Which class have I to use in the following case:
>
>   InputStream resourceAsStream =
> Test.class.getResourceAsStream("test.xsl");
>
> I tried some but the result is "resourceAsStream == null"
>
> Which one should I use?

See JDK Class#getResourceAsStream. File must be available from the classloader, see docs for search locations.

- Jörg
Reply | Threaded
Open this post in threaded view
|

[xstream-user] Re: HOWTO: Using XSLT to convert XML attributes to elements

Holger-3
> Holger wrote on Tuesday, November 15, 2005 12:52 PM:
>
> > Which class have I to use in the following case:
> >
> >   InputStream resourceAsStream =
> > Test.class.getResourceAsStream("test.xsl");
> >
> > I tried some but the result is "resourceAsStream == null"
> >
> > Which one should I use?
>
> See JDK Class#getResourceAsStream. File must be available from the
classloader, see docs for search locations.
>
> - J�rg
>
>

Don't matter what I do, the result is "null".

If I try
  this.getClass.getResourceAsStream("text.xsl");
the result is "null". So I changed the directory of the file, but my resource
could not be found.
Furthermore the file was not be found when I typed
  this.getClass().getResourceAsStream(D:\\text.xsl");

Whats now wrong?



Reply | Threaded
Open this post in threaded view
|

Re: [xstream-user] Re: HOWTO: Using XSLT to convert XML attributes to elements

Rickard Öberg
In reply to this post by Holger-3
Holger wrote:
> Which class have I to use in the following case:
>
>   InputStream resourceAsStream = Test.class.getResourceAsStream("test.xsl");
>
> I tried some but the result is "resourceAsStream == null"
>
> Which one should I use?

The above assumes that the file "test.xsl" is in the same directory as
the class file (Test.class) for the Test class. If you have put
"test.xsl" in the root directory of your classloader then use
"/test.xsl" instead. As J?rg said, see the docs in the JDK for
getResourceAsStream for more info about how it works.

/Rickard

--
Rickard ?berg
[hidden email]
@work +46-(0)19-173036