0

I am facing a problem by getting org.eclipse.emf.ecore.resource.Resource. from org.eclipse.emf.ecore.resource.ResourceSet by calling getResource(URI uri, boolean loadOnDemand) method of ResourceSet.

The problem is actually , this method takes "file" as an input, but I want to get Resource by giving "String" as a input.

For better understanding here is the code snippet.

import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;

public static void main(String args[]){

    ResourceSet set = new ResourceSetImpl();
    Resource resource = set.getResource(URI.createURI("c:/users/input/inputFile.txt"),
                true);
}

I have a String as a input but this api takes only file..so is there any other api who takes String as a input and get the Resource????

I also do not want to make file.

Daniel
  • 1,861
  • 1
  • 15
  • 23
  • Your question is very unclear. You keep repeating that the method takes a File as input, but you also provide the signature of the method which is `getResource(URI uri, boolean loadOnDemand)`. I don't see any File in this method signature. – JB Nizet Aug 25 '14 at 06:32
  • (URI.createURI("c:/users/input/inputFile.txt") createURI take a file and locate it and pass it to getResource. – Hakim Saifee Aug 25 '14 at 06:37

1 Answers1

0

Try,

int resID = getResources().getIdentifier("my_string", "string", getPackageName());

Check this - Android getIdentifier doesn't work for string?

Community
  • 1
  • 1
sjain
  • 23,126
  • 28
  • 107
  • 185