Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Get the nsURI by a resource
Get the nsURI by a resource [message #420348] Wed, 25 June 2008 16:15 Go to next message
Oelerink is currently offline OelerinkFriend
Messages: 129
Registered: July 2009
Senior Member
Hello,

i've looked a lot, but i didn't find a method to give me the nsURI from
a Package by a xml file. I do the following:

URI fileURI = URI.createFileURI(filePath);
Resource resource = new XMIResourceImpl(fileURI);

try {
resource.load(null);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

EObject model = resource.getContents().get(0);


Now i want to get the nsURI without using an alternate xmlparser.

Grretings
Re: Get the nsURI by a resource [message #420349 is a reply to message #420348] Wed, 25 June 2008 17:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Hi,

There isn't just one nsURI in a xml file. There is one for each unique
package that is found for each of the eObjects that are in the file.

To get the nsURI for a particular EObject you would do:

EObject model;

String nsURI = model.eClass().getEPackage().getNsURI();


--
Thanks,
Rich Kulp
Re: Get the nsURI by a resource [message #420356 is a reply to message #420349] Wed, 25 June 2008 21:28 Go to previous message
Oelerink is currently offline OelerinkFriend
Messages: 129
Registered: July 2009
Senior Member
Thanks this helped me.

Rich Kulp schrieb:
> Hi,
>
> There isn't just one nsURI in a xml file. There is one for each unique
> package that is found for each of the eObjects that are in the file.
>
> To get the nsURI for a particular EObject you would do:
>
> EObject model;
>
> String nsURI = model.eClass().getEPackage().getNsURI();
>
>
Previous Topic:ChangeRecorder and eConntainer
Next Topic:Re: [Teneo] 1.0.0 Newbie trouble with JPOX library tutorial
Goto Forum:
  


Current Time: Thu Apr 25 15:14:30 GMT 2024

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

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

Back to the top