Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Opening files in RAP project
Opening files in RAP project [message #82891] Mon, 14 April 2008 23:14 Go to next message
Eclipse UserFriend
Originally posted by: tavoaqp.gmail.com

Hi everybody
Im having a very simple problem (I think) although I can't solve it
because of my lack of knowledge about Equinox.
I want to open an XML file in the start method of my plugin, how can I
do that? So far I have tried the following:

Bundle bundle=Platform.getBundle(MyPluginActivator.PLUGIN_ID);
URL found=bundle.getResource("testfile.xml");

InputStream fileinput=found.openStream();

but when I "fileInput" that to a SAXParser instance and try to load it,
the debugger shows this message:

java.lang.IllegalArgumentException: InputStream cannot be null

Any hints on this issue?

I will appreciate any help.

Best Regards

Gustavo
Re: Opening files in RAP project [message #82921 is a reply to message #82891] Tue, 15 April 2008 07:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: benjamin.wolff.web.de

here is a snippet of how i open xml files in my app:

is =
getClass().getClassLoader().getResourceAsStream("resources/templates/anschreiben_betrieb.xml ");

this method returns an inputstream which you can use to parse. the files
are located in <project folder>/resources/templates/

hth
-ben
Re: Opening files in RAP project [message #82951 is a reply to message #82891] Tue, 15 April 2008 08:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi,

where does the file reside in your bundle?


Ciao
Frank

-----Ursprüngliche Nachricht-----
Von: Gustavo [mailto:tavoaqp@gmail.com]
Bereitgestellt: Dienstag, 15. April 2008 01:14
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: Opening files in RAP project
Betreff: Opening files in RAP project


Hi everybody
Im having a very simple problem (I think) although I can't solve it
because of my lack of knowledge about Equinox.
I want to open an XML file in the start method of my plugin, how can I
do that? So far I have tried the following:

Bundle bundle=Platform.getBundle(MyPluginActivator.PLUGIN_ID);
URL found=bundle.getResource("testfile.xml");

InputStream fileinput=found.openStream();

but when I "fileInput" that to a SAXParser instance and try to load it,
the debugger shows this message:

java.lang.IllegalArgumentException: InputStream cannot be null

Any hints on this issue?

I will appreciate any help.

Best Regards

Gustavo
Re: Opening files in RAP project [message #83036 is a reply to message #82951] Tue, 15 April 2008 13:59 Go to previous message
Eclipse UserFriend
Originally posted by: tavoaqp.gmail.com

Hi Frank
I solved the issue with the following:

Bundle bundle=Platform.getBundle(AWActivator.PLUGIN_ID);
URL fileURL=BundleUtility.find(bundle, "testfile.xml");
fileURL.openStream();
FileInputStream br=(FileInputStream) fileURL.getContent();

it seems the stream needs to be opened first.

Thanks
Gustavo

Frank Appel wrote:
> Hi,
>
> where does the file reside in your bundle?
>
>
> Ciao
> Frank
>
> -----Ursprüngliche Nachricht-----
> Von: Gustavo [mailto:tavoaqp@gmail.com]
> Bereitgestellt: Dienstag, 15. April 2008 01:14
> Bereitgestellt in: eclipse.technology.rap
> Unterhaltung: Opening files in RAP project
> Betreff: Opening files in RAP project
>
>
> Hi everybody
> Im having a very simple problem (I think) although I can't solve it
> because of my lack of knowledge about Equinox.
> I want to open an XML file in the start method of my plugin, how can I
> do that? So far I have tried the following:
>
> Bundle bundle=Platform.getBundle(MyPluginActivator.PLUGIN_ID);
> URL found=bundle.getResource("testfile.xml");
>
> InputStream fileinput=found.openStream();
>
> but when I "fileInput" that to a SAXParser instance and try to load it,
> the debugger shows this message:
>
> java.lang.IllegalArgumentException: InputStream cannot be null
>
> Any hints on this issue?
>
> I will appreciate any help.
>
> Best Regards
>
> Gustavo
>
Previous Topic:ToolTipText problem
Next Topic:Jfree
Goto Forum:
  


Current Time: Fri Apr 26 00:30:52 GMT 2024

Powered by FUDForum. Page generated in 0.03437 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top