Skip to main content



      Home
Home » Newcomers » Newcomers » Reading and Writing to/from external file
Reading and Writing to/from external file [message #260342] Tue, 08 July 2008 08:42 Go to next message
Eclipse UserFriend
Originally posted by: gang.xu.delphi.com

Hi,
I was wondering if anyone knew of a tutorial or could explain here how to
read and write to a .txt or .xml file using eclipse. Basically, I am
allowing the user to make a tree, and I would like for him to be able to
save and reload it later.
How do I read/write, and what do I use to specify location for save/load?
I am used to command prompt world so this is a bit new for me.

Thanks!
Re: Reading and Writing to/from external file [message #260346 is a reply to message #260342] Tue, 08 July 2008 09:03 Go to previous messageGo to next message
Eclipse UserFriend
This is a multi-part message in MIME format.
--------------000209050003040806020300
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Dan,

This tutorial will generate a fully functional editor that does pretty
much exactly what you describe:
< http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc/tutorials/xlibmod/xlibmod.html>


http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc/tutorials/xlibmod/xlibmod.html

If you can define your tree structure with an XML Schema, you'd
basically be done.


Dan Xu wrote:
> Hi,
> I was wondering if anyone knew of a tutorial or could explain here how
> to read and write to a .txt or .xml file using eclipse. Basically, I
> am allowing the user to make a tree, and I would like for him to be
> able to save and reload it later. How do I read/write, and what do I
> use to specify location for save/load? I am used to command prompt
> world so this is a bit new for me.
>
> Thanks!
>

--------------000209050003040806020300
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Dan,<br>
<br>
This tutorial will generate a fully functional editor that does pretty
much exactly what you describe:<a
href=" http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc/tutorials/xlibmod/xlibmod.html"><br>
</a>
<blockquote><a
href=" http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc/tutorials/xlibmod/xlibmod.html"> http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc/tutorials/xlibmod/xlibmod.html</a><br>
</blockquote>
If you can define your tree structure with an XML Schema, you'd
basically be done.<br>
<br>
<br>
Dan Xu wrote:
<blockquote
cite="mid:3c89e502ab4eaabc4016a70ac2db12d9$1@www.eclipse.org"
type="cite">Hi,
<br>
I was wondering if anyone knew of a tutorial or could explain here how
to read and write to a .txt or .xml file using eclipse. Basically, I am
allowing the user to make a tree, and I would like for him to be able
to save and reload it later. How do I read/write, and what do I use to
specify location for save/load? I am used to command prompt world so
this is a bit new for me.
<br>
<br>
Thanks!
<br>
<br>
</blockquote>
</body>
</html>

--------------000209050003040806020300--
Re: Reading and Writing to/from external file [message #260350 is a reply to message #260342] Tue, 08 July 2008 09:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: codeslave.ca.ibm.com

There are many ways to accomplish this, but perhaps you want to model
your .xml file using EMF and generate an editor which your user can use
to create an instance of that model, then save it as .xml / .xmi
anywhere they choose (likely in their workspace) for reuse/reload later.

http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.emf.doc/tutorials/clibmod/clibmod.html

Dan Xu wrote:
> Hi,
> I was wondering if anyone knew of a tutorial or could explain here how
> to read and write to a .txt or .xml file using eclipse. Basically, I am
> allowing the user to make a tree, and I would like for him to be able to
> save and reload it later. How do I read/write, and what do I use to
> specify location for save/load? I am used to command prompt world so
> this is a bit new for me.
>
> Thanks!
>

--
Nick Boldt :: Release Engineer, IBM Toronto Lab
Eclipse Modeling :: http://www.eclipse.org/modeling
http://wiki.eclipse.org/index.php/User:Nickb
Re: Reading and Writing to/from external file [message #260407 is a reply to message #260346] Tue, 08 July 2008 15:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gang.xu.delphi.com

Thanks, but for some reason I don't have all the components (plug-ins)
that are mentioned in the tutorial. For instance, I don't even see XML
Schema as a selection option from "Select a model importer"

I googled it and this led me to dowloading from
http://www.eclipse.org/modeling/mdt/downloads/?project=xsd , but I still
don't see it appearing.

I have the latest release of Ganymede, so are there additional plug-ins
that are required for me to build this model?
Re: Reading and Writing to/from external file [message #260420 is a reply to message #260407] Tue, 08 July 2008 15:22 Go to previous messageGo to next message
Eclipse UserFriend
This is a multi-part message in MIME format.
--------------000405020702040303000605
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Dan,

The hard-to-find modeling package has it all:

http://www.eclipse.org/downloads/packages/

But you should be able to add it to any installation you already have
using Help->Software Updates...-> Available Software->Ganymede Update
Site->Models and Model Development->XSD SDK; of course you'll want to
install the EMF SDK as well.


Dan Xu wrote:
> Thanks, but for some reason I don't have all the components (plug-ins)
> that are mentioned in the tutorial. For instance, I don't even see XML
> Schema as a selection option from "Select a model importer"
>
> I googled it and this led me to dowloading from
> http://www.eclipse.org/modeling/mdt/downloads/?project=xsd , but I
> still don't see it appearing.
> I have the latest release of Ganymede, so are there additional
> plug-ins that are required for me to build this model?
>

--------------000405020702040303000605
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Dan,<br>
<br>
The hard-to-find modeling package has it all:<br>
<blockquote><a href="http://www.eclipse.org/downloads/packages/">http://www.eclipse.org/downloads/packages/</a><br>
</blockquote>
But you should be able to add it to any installation you already have
using Help-&gt;Software Updates...-&gt; Available Software-&gt;Ganymede
Update Site-&gt;Models and Model Development-&gt;XSD SDK; of course
you'll want to install the EMF SDK as well.<br>
<br>
<br>
Dan Xu wrote:
<blockquote
cite="mid:2f7b27212c78573e83d010af53cfefc8$1@www.eclipse.org"
type="cite">Thanks, but for some reason I don't have all the
components (plug-ins) that are mentioned in the tutorial. For instance,
I don't even see XML Schema as a selection option from "Select a model
importer"
<br>
<br>
I googled it and this led me to dowloading from
<a class="moz-txt-link-freetext" href="http://www.eclipse.org/modeling/mdt/downloads/?project=xsd">http://www.eclipse.org/modeling/mdt/downloads/?project=xsd</a> , but I
still don't see it appearing. <br>
I have the latest release of Ganymede, so are there additional plug-ins
that are required for me to build this model?
<br>
<br>
</blockquote>
</body>
</html>

--------------000405020702040303000605--
Re: Reading and Writing to/from external file [message #260424 is a reply to message #260420] Tue, 08 July 2008 15:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gang.xu.delphi.com

Thanks. On another note, clicking on the Ganymede Update site under
"available software" in SoftWare Updates gives me the following dialog:

No repository found at http://download.eclipse.org/releases/ganymede
Error reading update site http://download.eclipse.org/releases/ganymede.
download.eclipse.org

How do I correct this? I can see this being quite a nuisance in the future
Re: Reading and Writing to/from external file [message #260428 is a reply to message #260424] Tue, 08 July 2008 15:55 Go to previous messageGo to next message
Eclipse UserFriend
Dan,

I've seen such questions before on this newsgroup. Usually folks start
asking about firewalls and proxy servers... Could those be blocking
your access?


Dan Xu wrote:
> Thanks. On another note, clicking on the Ganymede Update site under
> "available software" in SoftWare Updates gives me the following dialog:
>
> No repository found at http://download.eclipse.org/releases/ganymede
> Error reading update site http://download.eclipse.org/releases/ganymede.
> download.eclipse.org
>
> How do I correct this? I can see this being quite a nuisance in the
> future
>
Re: Reading and Writing to/from external file [message #260446 is a reply to message #260428] Tue, 08 July 2008 16:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gang.xu.delphi.com

Ah-that must be it. Unfortunately I can't fiddle with the firewall, so I
will manually download everything.

By the way, after I downloaded the 300 MB
eclipse-modeling-ganymede-incubation-win32.zip folder, WinZip tells me:

"Cannot open file: it does not appear to be a valid archive.
If you downloaded this file, try downloading the file again."

Since it took an hour to download (This time the silly antivirus software
had to scan it as it downloaded), I don't think I will try it again. Did I
grab the wrong thing?

Thanks again for everything!
Re: Reading and Writing to/from external file [message #260465 is a reply to message #260446] Tue, 08 July 2008 18:13 Go to previous messageGo to next message
Eclipse UserFriend
Dan,

It sounds like it might have been corrupted during download. I just
tried it with my friends of Eclipse mirror (which took 7 minutes) and it
unzipped okay.


Dan Xu wrote:
> Ah-that must be it. Unfortunately I can't fiddle with the firewall, so
> I will manually download everything.
>
> By the way, after I downloaded the 300 MB
> eclipse-modeling-ganymede-incubation-win32.zip folder, WinZip tells me:
>
> "Cannot open file: it does not appear to be a valid archive.
> If you downloaded this file, try downloading the file again."
>
> Since it took an hour to download (This time the silly antivirus
> software had to scan it as it downloaded), I don't think I will try it
> again. Did I grab the wrong thing?
>
> Thanks again for everything!
>
Re: Reading and Writing to/from external file [message #260485 is a reply to message #260465] Tue, 08 July 2008 22:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: codeslave.ca.ibm.com

You might want to try getting individual jars from an FTP mirror such as
this one:

ftp://eclipse.mirrors.tds.net/pub/eclipse.org/releases/ganym ede/

Here's the full list:

http://www.eclipse.org/downloads/download.php?file=/releases /ganymede/&protocol=ftp

Here's the minimum list of jars (5) you need for XSD support w/ EMF:

http://wiki.eclipse.org/XSD-FAQ#I_want_to_use_XSD_in_my_stan dalone_project.2C_or_include_only_a_working_subset_of_the_co de._What_libraries_.28jar_files.29_do_I_need_in_my_CLASSPATH .3F

That's cumbersome, but small files might come down the pipe easier than
large ones for you, and you can use a download manager to enforce
multiple concurrent downloads and start/resume capability. I use the
"Download Them All" plugin for Firefox, FWIW.

If you find that your nearest mirror doesn't provide FTP downloads or
their downloads are corrupted, please report it to webmaster@eclipse.org
so they can contact the mirror and get the broken file(s) fixed.

Here's the FTP mirror list for the Ganymede Modeling package for Win32:

http://www.eclipse.org/downloads/download.php?file=/technolo gy/epp/downloads/release/ganymede/R/eclipse-modeling-ganymed e-incubation-win32.zip&protocol=ftp

Nick

Ed Merks wrote:
> Dan,
>
> It sounds like it might have been corrupted during download. I just
> tried it with my friends of Eclipse mirror (which took 7 minutes) and it
> unzipped okay.
>
>
> Dan Xu wrote:
>> Ah-that must be it. Unfortunately I can't fiddle with the firewall, so
>> I will manually download everything.
>>
>> By the way, after I downloaded the 300 MB
>> eclipse-modeling-ganymede-incubation-win32.zip folder, WinZip tells me:
>>
>> "Cannot open file: it does not appear to be a valid archive.
>> If you downloaded this file, try downloading the file again."
>>
>> Since it took an hour to download (This time the silly antivirus
>> software had to scan it as it downloaded), I don't think I will try it
>> again. Did I grab the wrong thing?
>>
>> Thanks again for everything!
>>

--
Nick Boldt :: Release Engineer, IBM Toronto Lab
Eclipse Modeling :: http://www.eclipse.org/modeling
http://wiki.eclipse.org/index.php/User:Nickb
Re: Reading and Writing to/from external file [message #260665 is a reply to message #260342] Thu, 10 July 2008 12:20 Go to previous messageGo to next message
Eclipse UserFriend
Dan Xu wrote:
> Hi,
> I was wondering if anyone knew of a tutorial or could explain here how
> to read and write to a .txt or .xml file using eclipse. Basically, I
> am allowing the user to make a tree, and I would like for him to be
> able to save and reload it later. How do I read/write, and what do I
> use to specify location for save/load? I am used to command prompt
> world so this is a bit new for me.
Is the file inside the workspace? Also, the previous responses talk
about creating your own editor. Do you need that at all?

Dani
>
> Thanks!
>
Re: Reading and Writing to/from external file [message #260734 is a reply to message #260342] Fri, 11 July 2008 02:30 Go to previous messageGo to next message
Eclipse UserFriend
i think you can use eclipse xml editor to achieve your aim
Re: Reading and Writing to/from external file [message #260764 is a reply to message #260485] Fri, 11 July 2008 09:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gang.xu.delphi.com

I think it may just be my computer or my WinZip-I realized I downloaded
Ganymede Java EE rather than Classic (hence I have no source files), and I
got the same error message after I downloaded Eclipse Classic 3.4
Re: Reading and Writing to/from external file [message #260775 is a reply to message #260446] Fri, 11 July 2008 09:58 Go to previous messageGo to next message
Eclipse UserFriend
Dan Xu wrote:
>WinZip tells me:
>
> "Cannot open file: it does not appear to be a valid archive.
> If you downloaded this file, try downloading the file again."

If its really Winzip, then I don't know. But i heard things about fake
corruption messages by the Microsoft Unzipper that is included in their
products.

Felix
Re: Reading and Writing to/from external file [message #260832 is a reply to message #260665] Fri, 11 July 2008 17:22 Go to previous message
Eclipse UserFriend
Originally posted by: gang.xu.delphi.com

I am going to use the FileDialog class to specify location to save/load
the external xml file (which does not have to be in the workspace).

Basically, I just need a way to convert my treeView into an xml file of
the sort (see below) and back again.

<Root
name = "root"
assoc = "C:\projects\CProject1">
<ChildNode
name = "son"
value = "1">
<GrandChildNode
name = "grandkid"
value = "0.4">
</GrandChildNode>
<ChildNode>

<ChildNode
name = "daughter"
value = "2">
<ChildNode>
</Root>


Right now, I'm about to write my own class to take my object model and
convert it into such an xml file, and also to parse it back. This is where
I'm open to suggestions :)
Previous Topic:Getting location of a cfile from IFunction object
Next Topic:Show a simple program on an editor page
Goto Forum:
  


Current Time: Sun Jul 20 11:41:29 EDT 2025

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

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

Back to the top