tracing EObjects to locations in a XML file [message #186045] |
Thu, 11 January 2007 19:02 |
Eclipse User |
|
|
|
Originally posted by: rasmusmodsat.hotmail.com
Hi,
I recently asked the following question on the EMF group and was told, that
the WTP group had already solved this problem. So if anyone can answer this
question and direct me to the appropriate place in the source then I would
be very grateful.
I have a method which loads an xml file based on a previously generated
xsd2ecore-mapping and generated model code.
public Resource loadResource(String path, String eNS, EPackage ePackage,
Resource.Factory resourceFactory) {
System.out.println("load resource: "+path);
ResourceSet resourceSet = new ResourceSetImpl();
final ExtendedMetaData extendedMetaData = new
BasicExtendedMetaData(resourceSet.getPackageRegistry());
resourceSet.getLoadOptions().put(XMLResource.OPTION_EXTENDED _META_DATA,
extendedMetaData);
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION, resourceFactory);
resourceSet.getPackageRegistry().put(eNS, ePackage);
Resource resource = resourceSet.getResource(URI.createFileURI(path),
true);
return resource;
}
This gives me a Resource with an instance of my EMF model. My question now
is: How can I trace EObjects back to specific locations in my xml-file? I
imagine a marker-based approach.
-- HW
|
|
|
Powered by
FUDForum. Page generated in 0.03683 seconds