Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Programmatically do XML Catalog contributions in WST
Programmatically do XML Catalog contributions in WST [message #204397] Wed, 14 November 2007 11:45 Go to next message
Anders Olsson is currently offline Anders OlssonFriend
Messages: 21
Registered: July 2009
Junior Member
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 #204473 is a reply to message #204397] Thu, 15 November 2007 20:00 Go to previous messageGo to next message
Lawrence Mandel is currently offline Lawrence MandelFriend
Messages: 486
Registered: July 2009
Senior Member
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
Re: Programmatically do XML Catalog contributions in WST [message #204685 is a reply to message #204473] Mon, 19 November 2007 08:32 Go to previous messageGo to next message
Anders Olsson is currently offline Anders OlssonFriend
Messages: 21
Registered: July 2009
Junior Member
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
Re: Programmatically do XML Catalog contributions in WST [message #204734 is a reply to message #204685] Tue, 20 November 2007 04:49 Go to previous messageGo to next message
Lawrence Mandel is currently offline Lawrence MandelFriend
Messages: 486
Registered: July 2009
Senior Member
Hi Anders,

Did you try to clear the configuration area when launching a runtime
workspace? I've found this is sometimes a problem. There's an option in
the launch configuration.

Lawrence
Re: Programmatically do XML Catalog contributions in WST [message #204740 is a reply to message #204734] Tue, 20 November 2007 08:24 Go to previous messageGo to next message
Anders Olsson is currently offline Anders OlssonFriend
Messages: 21
Registered: July 2009
Junior Member
The problem was a ClassCastException. I had missed it before, due to my
own output scrolling past it. The problem seems to be that I had followed
the instructions and let my class implement
org.eclipse.wst.common.uriresolver.internal.provisional.URIR esolver
but in
org.eclipse.wst.common.uriresolver.internal.URIResolverExten sionDescriptor
the class gets cast to
org.eclipse.wst.common.uriresolver.internal.provisional.URIR esolverExtension

Changing Interface and adding appropriate methods did the trick, and now
the Resolver works as advertised.

I also checked the more current documentation at:
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. wst.doc.isv/reference/extension-points/common/org_eclipse_ws t_common_uriresolver_resolverExtensions.html
and the suggested interface to implement is still the same (wrong) one. Is
this base for filing a bug?

Many thanks to you Lawrence.

/Anders

lmandel@ca.ibm.com wrote:

> Hi Anders,

> Did you try to clear the configuration area when launching a runtime
> workspace? I've found this is sometimes a problem. There's an option in
> the launch configuration.

> Lawrence
Re: Programmatically do XML Catalog contributions in WST [message #204768 is a reply to message #204740] Wed, 21 November 2007 03:41 Go to previous message
Lawrence Mandel is currently offline Lawrence MandelFriend
Messages: 486
Registered: July 2009
Senior Member
>Is this base for filing a bug?

Absolutely. Bugs are not restricted to code problems. Bugs include
documentation, the Web site, and even WTP process.

Lawrence
Previous Topic:Deploying WST Plugin recursively
Next Topic:Help with WSDL Validation please, any rules listing?
Goto Forum:
  


Current Time: Tue Apr 23 10:54:41 GMT 2024

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

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

Back to the top