Gather element lines when loading a resource (without extending XMLHandler) [message #1837561] |
Tue, 02 February 2021 12:00  |
Alfonso de la Vega Messages: 18 Registered: January 2016 |
Junior Member |
|
|
Hi,
I am trying to capture the lines of the original model file that correspond to each object being loaded from an EMF Resource.
I have seen that it is possible to do this by creating a specific XMIResourceImpl, along with an XMLLoad and an XMLHandler. Then, I can gather these lines from the Locator element of the handler during element parsing.
However, using a custom resource loading implementation loses any modifications that might be necessary when loading specific resources (e.g. Sirius ones), which might have their own special XMLLoad and XMLHandler implementations. This can translate into performance problems as well as losing some metadata information.
I have also tried to decorate these classes to wrap their functionality, but unfortunately Java does not allow to decorate protected methods (which are overridden in several places, for instance the createXMLLoad( ) of an XMIResourceImpl, or the makeDefaultHandler( ) of an XMLLoadImpl object).
Is there any other way to get the original file lines of the objects of a loading (or already loaded) Resource that I am missing?
Many thanks,
Alfonso
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02061 seconds