Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » SSE & XML Catalog binding
SSE & XML Catalog binding [message #189444] Thu, 08 March 2007 20:06 Go to next message
Eclipse UserFriend
Originally posted by: chris.spilio.hotmail.com

Hi guys,

i have the following question. I have created a plug-in which makes
an editor contribution to the UI, which is an extension of the SSE. The
editor is used to edit an XML-based language (therefore a new content
type contribution) which has a corresponding file extension. There is
also a schema definition (XSD) file available for validating the
language source.

I'm putting a good amount of work in customizing the content
assistance facilities of the editor (which extend the XML editor's
content assistant), therefore instead of trying to re-invent the wheel
and start writing huge amounts of code for source validation, i followed
the right path, i.e. using the XSD file through the XML Catalog. So far
so good. The validation logic is done by the SSE automatically with the
use of the schema file and i'm able to enhance the content assistance
facilities.

Now, my problem is that i want (if possible) to hide all the binding
details of the editor with the XML catalog's entry, so that the user
will not be able to change the namespace declarations withing the
editor's source. What i mean is something like this:

in order for XSD validation to work, this is the standard way of
doing things (XML Catalog-wise):

<a xmlns="http://key">
<b>
</b>
</a>

but what i need is a 'behind-the-scenes' programmatic way of binding the
schema definition, so that the editor plug-in's user will not have to
know any of these things, in order to be able just to write:

<a>
<b>
</b>
</a>

So, is there any way of dynamically binding the source content of the
editor with an XML Catalog entry, or if not is there a way of having the
<a xmlns="http://key"> always available as the root element and NOT
letting the user to change it? Sorry for the long question and thanx
for your time in advance!

Chris
Re: SSE & XML Catalog binding [message #190594 is a reply to message #189444] Wed, 28 March 2007 18:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: webwhysguy.gmail.com

Hi Chris,

Were you able to find a resolution to this problem? I posted a similar
question not too long ago without any luck. If you were able to find a
solution could you post it or contact me offline (webwhysguy@gmail.com)?

Take Care,
- Billy

"chris" <chris.spilio@hotmail.com> wrote in message
news:espqbh$qeh$1@utils.eclipse.org...
> Hi guys,
>
> i have the following question. I have created a plug-in which makes an
> editor contribution to the UI, which is an extension of the SSE. The
> editor is used to edit an XML-based language (therefore a new content type
> contribution) which has a corresponding file extension. There is also a
> schema definition (XSD) file available for validating the language source.
>
> I'm putting a good amount of work in customizing the content assistance
> facilities of the editor (which extend the XML editor's content
> assistant), therefore instead of trying to re-invent the wheel and start
> writing huge amounts of code for source validation, i followed the right
> path, i.e. using the XSD file through the XML Catalog. So far so good.
> The validation logic is done by the SSE automatically with the use of the
> schema file and i'm able to enhance the content assistance facilities.
>
> Now, my problem is that i want (if possible) to hide all the binding
> details of the editor with the XML catalog's entry, so that the user will
> not be able to change the namespace declarations withing the editor's
> source. What i mean is something like this:
>
> in order for XSD validation to work, this is the standard way of doing
> things (XML Catalog-wise):
>
> <a xmlns="http://key">
> <b>
> </b>
> </a>
>
> but what i need is a 'behind-the-scenes' programmatic way of binding the
> schema definition, so that the editor plug-in's user will not have to know
> any of these things, in order to be able just to write:
>
> <a>
> <b>
> </b>
> </a>
>
> So, is there any way of dynamically binding the source content of the
> editor with an XML Catalog entry, or if not is there a way of having the
> <a xmlns="http://key"> always available as the root element and NOT
> letting the user to change it? Sorry for the long question and thanx for
> your time in advance!
>
> Chris
>
>
Re: SSE & XML Catalog binding [message #190681 is a reply to message #190594] Thu, 29 March 2007 09:55 Go to previous messageGo to next message
Craig Salter is currently offline Craig SalterFriend
Messages: 169
Registered: July 2009
Senior Member
AFAIK, you can't do this today. But with a few code changes you may be
able to achieve what you want. Here's a recipe..

1) First you need to some hook so you can tweak your SSE model when it
loads. Check out the modelHandler extension point. For your particular
content type, you can specialize the modelHandler.

2) Now you've got hold of the SSE DOM model you want to much with it to
add an 'invisible namespace declaration'. There's a couple of ways you
can attach some magic state to the model to achieve this (not sure which
will be easiest).

a) The first way involves registering an adapter factory in the model
handler. Then you can use a getAdapterFor(Object type) call to grab some
state that will hold your 'invisible namespace declaration'. We'd need to
agree on the 'Object type' value that'd be used here to access the
namespace info.
-- or ---
b) Get hold of the document node and use the recently added setUserData()
method on a document Node to specify an 'invisible' xml namespace for your
node. We'd need to agree on a 'magic string' to use for the key value.

3) (here's where code changes to WTP are required)
Update WTP's
org.eclipse.wst.xml.core.internal.contentmodel.util.Namespac eTable class
so that in the constructor you grab any 'invisible' namespaces from the
document node (how we'd 'grab' this data would depend on which apprach we
used (a) or (b)). BTW, If you look at the constructor of this class
you'll see some evidence of where we've toyed with something similar in
the past, albeit before the setUserData() method was added.

So if anyone is willing to experiment with this and provide a small patch
to the NamespaceTable class to enable this, I'd be happy to look over the
code and consider committing change. If you're willing to persue this
please open a WTP bug to track this issue and host code contributions.

hope that helps
craig
Re: SSE & XML Catalog binding [message #190768 is a reply to message #190681] Thu, 29 March 2007 22:03 Go to previous message
Eclipse UserFriend
Originally posted by: webwhysguy.gmail.com

Hi Craig,

Thanks for taking the time for such a detailed response. This particular
functionality is critical to my project, so I will definitely be putting
some time into working through the recipe you provided. As for which
approach to take for item number 2, my first inclination is to try the
setUserData() method, in part because it sounds like someone might have
tried the other approach without success. Regardless, I will investigate
both options. I will also start looking at the NamespaceTable class to see
what changes might make sense there.

I'll start looking over the code today and hopefully I can begin
experimenting with this approach sometime next week - depending on how fast
I can get my head around a solution. Unless you recommend otherwise, I will
hold off on creating a WTP bug until I get a better handle on the scope of
the effort. I'm sure I'll have plenty of questions during the process so
you'll likely see a few posts from me over the next week or two ;-). I will
also be sure to post a follow-up for those that might be interested.

Thanks again and take Care,
- Billy


"craig" <csalter@ca.ibm.com> wrote in message
news:910f3cf5c89deb196afbfadd37ff1d7d$1@www.eclipse.org...
> AFAIK, you can't do this today. But with a few code changes you may be
> able to achieve what you want. Here's a recipe..
>
> 1) First you need to some hook so you can tweak your SSE model when it
> loads. Check out the modelHandler extension point. For your particular
> content type, you can specialize the modelHandler.
>
> 2) Now you've got hold of the SSE DOM model you want to much with it to
> add an 'invisible namespace declaration'. There's a couple of ways you
> can attach some magic state to the model to achieve this (not sure which
> will be easiest).
> a) The first way involves registering an adapter factory in the model
> handler. Then you can use a getAdapterFor(Object type) call to grab some
> state that will hold your 'invisible namespace declaration'. We'd need to
> agree on the 'Object type' value that'd be used here to access the
> namespace info.
> -- or ---
> b) Get hold of the document node and use the recently added setUserData()
> method on a document Node to specify an 'invisible' xml namespace for your
> node. We'd need to agree on a 'magic string' to use for the key value.
>
> 3) (here's where code changes to WTP are required) Update WTP's
> org.eclipse.wst.xml.core.internal.contentmodel.util.Namespac eTable class
> so that in the constructor you grab any 'invisible' namespaces from the
> document node (how we'd 'grab' this data would depend on which apprach we
> used (a) or (b)). BTW, If you look at the constructor of this class
> you'll see some evidence of where we've toyed with something similar in
> the past, albeit before the setUserData() method was added.
>
> So if anyone is willing to experiment with this and provide a small patch
> to the NamespaceTable class to enable this, I'd be happy to look over the
> code and consider committing change. If you're willing to persue this
> please open a WTP bug to track this issue and host code contributions.
>
> hope that helps
> craig
>
Previous Topic:Tomcat Server fails to start in profile mode.
Next Topic:WS-I Validator outside of Eclipse
Goto Forum:
  


Current Time: Tue Apr 16 04:12:52 GMT 2024

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

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

Back to the top