Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [emf-dev] Saving a to your own format



Jeff,

Thanks for the kind words.

The easiest way to use EMF to load and save XML files of a specific format
is to use an XML Schema (that defines the format) to define the model.
Then,
EMF will automatically customize the default serializer to work with that
XML
format.

You typically load an XML file with EMF using code something like this:

  ResourceSet resourceSet = new ResourceSetImpl();
  URI fileURI = URI.createFileURI(".../myfile.xml");
  Resource myResource = resourceSet.getResource(fileURI, true);
  RootObjectClass rootObject =
(RootObjectClass)myResource.getContents().get(0);

The EMF book (http://www.junglescan.com/redirect.cfm?asin=0131425420)
provides the best explanation of all this.

Frank.




                                                                                                                                          
                      Jeff Richley                                                                                                        
                      <jeffrichley@yaho        To:       emf-dev@xxxxxxxxxxx                                                              
                      o.com>                   cc:                                                                                        
                      Sent by:                 Subject:  [emf-dev] Saving a to your own format                                            
                      emf-dev-admin@ecl                                                                                                   
                      ipse.org                                                                                                            
                                                                                                                                          
                                                                                                                                          
                      01/15/2004 06:46                                                                                                    
                      PM                                                                                                                  
                      Please respond to                                                                                                   
                      emf-dev                                                                                                             
                                                                                                                                          
                                                                                                                                          



Hello, I am new to the list and have a question.  I
have been programming with GEF for about 6 months now
and have decided to venture into EMF.  Wow, do I wish
I had done this 6 months ago!

My project requires a special xml format that is close
to the XMI that EMF spits out, but not quite.  What is
the recomended way of saving and loading custom files?

I did find the onSave() (and others) and had access to
an URI object that points to the file, but couldn't
quite figure out how to use the URI class to get a
stream to the file.  If someone could explain that, I
could be on my merry way.

By the way, great job on this project, my hat tips to
you!

Jeff Richley

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
_______________________________________________
emf-dev mailing list
emf-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/emf-dev





Back to the top