Creating new Xtext resource through code [message #1238459] |
Sat, 01 February 2014 12:14 |
|
Hi all,
I am actually trying to create a new xtext resource through code.
For e.g I have created a project in my xtext tool (as dsl needs to be contained in a project) and under this project I am trying to create a xtext resource, add content and save it. What I have done actually is:
private Resource createandSaveResource(String path, MyModel Obj){
ResourseSet rs=new ResourseSetImpl();
Resource resource= rs.createResource(URI.createURI(path), true);
resource.getContents().add(obj);
[b]resource.save(Collections.EMPTY_MAP);[/b]
return resource;
}
Is it enough code to create the resource and add, save content to it.
rs.save(Collections.EMPTY_MAP) throws me a MalformedException: Unknown protocol d
How do I resolve it?
Can someone suggest me?
Thanks in advance
Arshad
[Updated on: Sat, 01 February 2014 12:16] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03873 seconds