Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Controlling XML URI resolution
Controlling XML URI resolution [message #431825] Mon, 27 July 2009 21:26 Go to next message
Derek Palma is currently offline Derek PalmaFriend
Messages: 141
Registered: July 2009
Senior Member
Hi,

I am loading XML files with EMF and need to control the URI resolution for
the namespace URIs. Without EMF I am used to using an EntityResolver for
this by directly registering it with the Xml parser API. I see that
org.eclipse.emf.xmi.XMEDefaultHandler seems to handle this and other related
functions. However, it is not clear what the right way to install my own
EntityResolver is. I suspect others have done this many times.

What is the typical approach for installing an EntityResolve or just hooking
URI resolution with EMF?

Thanks in advance,
Derek
Re: Controlling XML URI resolution [message #431830 is a reply to message #431825] Mon, 27 July 2009 21:43 Go to previous messageGo to next message
Mario Winterer is currently offline Mario WintererFriend
Messages: 136
Registered: July 2009
Senior Member
Hi Derek!

Have a look at the two load/save options
XMLResource.OPTION_RESOURCE_ENTITY_HANDLER and
XMLResource.OPTION_URI_HANDLER.
The values of these two options must be of type XMLResource.URIHandler and
XMLResource.ResourceEntityHandler. They allow a finde grained control over
uri resolution and entity handling. If you need both, you can implement both
interfaces in one class and provider an instance via option
OPTION_RESOURCE_ENTITY_HANDLER - XMLResource uses it as uri handler too.

Mario

"Derek Palma" <derek.palma@gmail.com> schrieb im Newsbeitrag
news:h4l631$mpb$1@build.eclipse.org...
> Hi,
>
> I am loading XML files with EMF and need to control the URI resolution for
> the namespace URIs. Without EMF I am used to using an EntityResolver for
> this by directly registering it with the Xml parser API. I see that
> org.eclipse.emf.xmi.XMEDefaultHandler seems to handle this and other
> related functions. However, it is not clear what the right way to install
> my own EntityResolver is. I suspect others have done this many times.
>
> What is the typical approach for installing an EntityResolve or just
> hooking URI resolution with EMF?
>
> Thanks in advance,
> Derek
Re: Controlling XML URI resolution [message #431875 is a reply to message #431830] Tue, 28 July 2009 15:22 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30700
Registered: July 2009
Senior Member
Note also that the URI converter of the resource set is consulted

InputStream inputStream = getURIConverter().createInputStream(uri,
options);

So with things like URI mappings or specialized URI handlers you might
be able to accomplish what you want...


Mario Winterer wrote:
> Hi Derek!
>
> Have a look at the two load/save options
> XMLResource.OPTION_RESOURCE_ENTITY_HANDLER and
> XMLResource.OPTION_URI_HANDLER.
> The values of these two options must be of type XMLResource.URIHandler
> and XMLResource.ResourceEntityHandler. They allow a finde grained
> control over uri resolution and entity handling. If you need both, you
> can implement both interfaces in one class and provider an instance
> via option OPTION_RESOURCE_ENTITY_HANDLER - XMLResource uses it as uri
> handler too.
>
> Mario
>
> "Derek Palma" <derek.palma@gmail.com> schrieb im Newsbeitrag
> news:h4l631$mpb$1@build.eclipse.org...
>> Hi,
>>
>> I am loading XML files with EMF and need to control the URI
>> resolution for the namespace URIs. Without EMF I am used to using an
>> EntityResolver for this by directly registering it with the Xml
>> parser API. I see that org.eclipse.emf.xmi.XMEDefaultHandler seems to
>> handle this and other related functions. However, it is not clear
>> what the right way to install my own EntityResolver is. I suspect
>> others have done this many times.
>>
>> What is the typical approach for installing an EntityResolve or just
>> hooking URI resolution with EMF?
>>
>> Thanks in advance,
>> Derek
>
Previous Topic:Archived resource
Next Topic:Cannot create duplicate references in non-containment list
Goto Forum:
  


Current Time: Mon Dec 16 12:20:48 GMT 2019

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

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

Back to the top