Programmatically do XML Catalog contributions in WST [message #204397] |
Wed, 14 November 2007 06:45  |
Eclipse User |
|
|
|
Hello!
I have a need for adding DTDs to the XML Catalog in WST. I cannot use the
org.eclipse.est.xml.core.catalogContributions Extension Point, since the
location of the DTDs might be different every startup (or on different
machines).
I've been looking at the internal classes in
org.eclipse.wst.xml.core.internal and .catalog to little avail. I've
managed to do:
XMLCorePlugin xmlPlug =
org.eclipse.wst.xml.core.internal.XMLCorePlugin.getDefault() ;
Catalog defaultXMLCatalog = (Catalog) xmlPlug.getDefaultXMLCatalog();
What I then should do is a bit unclear. I want to do is add entries one by
one. So I think the class I should instance and insert is CatalogEntry.
Problem is only it has it's constructor set as protected.
What I would of course want is a public API for XML Catalog contributions.
But for now I'm content with using the internals. Could someone tell me if
my approach makes sense, and where I've diverted from the correct path. It
cannot be the case that this is currently impossible.
Thanks in advance for any replies.
Best Regards,
Anders Olsson
|
|
|
|
Re: Programmatically do XML Catalog contributions in WST [message #204685 is a reply to message #204473] |
Mon, 19 November 2007 03:32   |
Eclipse User |
|
|
|
Thank you for your reply, Lawrence.
I've tried implementing this solution in my plug-in, but I've ran into
some problems.
What I've done is that I've added an extension:
<extension
point="org.eclipse.wst.common.uriresolver.resolverExtensions ">
<resolverExtension
class="schemaSetter.ResolverExtension1">
</resolverExtension>
</extension>
in my plug-in.
The schemaSetter.ResolverExtension1 class is very simple, and implements
org.eclipse.wst.common.uriresolver.internal.provisional.URIR esolver
in both the resolve and resolvePhysicalLocation methods I simply return a
URI string without checking the input arguments.
I would paste the code, but so far that's not where the problem lies. I
ran in debugging mode with break points in both the methods, and they were
never visited. What I tried to do is to validate an XML file, but all I
get is an error about <the original URI> not being found.
Is there something I've missed? Is there something more that needs to be
done to use this resource?
/Anders
lmandel@ca.ibm.com wrote:
> Hi Anders,
> If your contributed DTDs don't need to be viewable in the XML catalog you
> can create a custom URI resolver [1].
> [1]
>
http://help.eclipse.org/help31/topic/org.eclipse.wst.doc.isv /reference/extension-points/common/org_eclipse_wst_common_ur iresolver_resolverExtensions.html
> Lawrence
>>Hello!
>>
>>I have a need for adding DTDs to the XML Catalog in WST. I cannot use the
>>org.eclipse.est.xml.core.catalogContributions Extension Point, since the
>>location of the DTDs might be different every startup (or on different
>>machines).
>>
>>I've been looking at the internal classes in
>>org.eclipse.wst.xml.core.internal and .catalog to little avail. I've
>>managed to do:
>>
>>XMLCorePlugin xmlPlug =
>> org.eclipse.wst.xml.core.internal.XMLCorePlugin.getDefault() ;
>>Catalog defaultXMLCatalog = (Catalog) xmlPlug.getDefaultXMLCatalog();
>>
>>What I then should do is a bit unclear. I want to do is add entries one
> by
>>one. So I think the class I should instance and insert is CatalogEntry.
>>Problem is only it has it's constructor set as protected.
>>
>>What I would of course want is a public API for XML Catalog
> contributions.
>>But for now I'm content with using the internals. Could someone tell me
> if
>>my approach makes sense, and where I've diverted from the correct path.
> It
>>cannot be the case that this is currently impossible.
>>
>>Thanks in advance for any replies.
>>
>>Best Regards,
>>
>>Anders Olsson
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02438 seconds