Extending GREclipse contentassist with XML support

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Extending GREclipse contentassist with XML support

pcohen
Hi I would like to add a kind of XmlSlurper autocompletion feature to the GroovyEclipse.

In my mind I would like to have a kind of API with an annotation. Simply speaking imagine that I would like to write something like:
@XMLContract(url="urltomyschema.xsd", rootElement="rootNode")
def xmlresult = new XMLSluper().parse(CallToAService)

I mean that way that I know that my result will be an XML Structure compliant with a provided schema with the provided root element.
Then I would like to suggest completion based on the schema. If for example the rootNode contains three subnodes subnode1, subnode2 and subnode3, writing in the IDE
xmlresult. + Ctrl Space would suggest in addition to current Groovy results the three subnodes. My idea is to make XmlSlurper parsed object manipulation easier when schema is known.

Do you think such an extension could be valuable and interest other people ?

Since I started, I managed to visit Groovy AST structure and Java part (in may case) with JDT and also to parse XSD schema.
It starts to work and provide a pretty cool user experience for basic cases but I am not very satisfactory with the way I managed AST and also XSD analysis and would like the code to be improved.

My questions:
- Does this proposal make sense or be of interest for other people ?
- Has anybody some advices or pointers to navigate inside an XSD (like getting in a clean way attributes/children and so on) if possible using XSD plugin feature.
- Has anybody some advices and best practices to visit Groovy AST (i spent much time with the debugger to understand the structures while testing).

Thanks in advance.

Regards
Reply | Threaded
Open this post in threaded view
|

Re: Extending GREclipse contentassist with XML support

Andrew Eisenberg
This does sound like an interesting idea and I do think that many
people would be interested in this.  However, I don't think that this
mailing list is the best place to discuss your idea since this list is
more for developers of Groovy-Eclipse and you seem to want to ask
users of Groovy if this would be helpful.  I'd recommend asking this
question on [hidden email].

That being said, we will be releasing DSL support for Groovy-Eclipse
in the next week or so.  This will allow end-users (such as yourself)
to provide groovy scripts that can augment content assist and type
inferencing.

Unfortunately, in this initial version of DSL support, the scripts are
expected to be self-contained, so if you wanted to download and parse
an XSD, it would all have to be done in a single script.

That may not make sense for you and it may make more sense to create a
separate plugin that provides this infrastructure.  I would be willing
to help you through the process if you decide to go this route.  And
if the end result is a plugin of high quality, it could be contributed
back into Groovy-Eclipse itself.

But first, I'd have a discussion on the users list to gauge interest.

On Tue, Apr 12, 2011 at 11:58 PM,  <[hidden email]> wrote:

> Hi I would like to add a kind of XmlSlurper autocompletion feature to the
> GroovyEclipse.
>
> In my mind I would like to have a kind of API with an annotation. Simply
> speaking imagine that I would like to write something like:
> @XMLContract(url="urltomyschema.xsd", rootElement="rootNode")
> def xmlresult = new XMLSluper().parse(CallToAService)
>
> I mean that way that I know that my result will be an XML Structure
> compliant with a provided schema with the provided root element.
> Then I would like to suggest completion based on the schema. If for example
> the rootNode contains three subnodes subnode1, subnode2 and subnode3,
> writing in the IDE
> xmlresult. + Ctrl Space would suggest in addition to current Groovy results
> the three subnodes. My idea is to make XmlSlurper parsed object manipulation
> easier when schema is known.
>
> Do you think such an extension could be valuable and interest other people ?
>
> Since I started, I managed to visit Groovy AST structure and Java part (in
> may case) with JDT and also to parse XSD schema.
> It starts to work and provide a pretty cool user experience for basic cases
> but I am not very satisfactory with the way I managed AST and also XSD
> analysis and would like the code to be improved.
>
> My questions:
> - Does this proposal make sense or be of interest for other people ?
> - Has anybody some advices or pointers to navigate inside an XSD (like
> getting in a clean way attributes/children and so on) if possible using XSD
> plugin feature.
> - Has anybody some advices and best practices to visit Groovy AST (i spent
> much time with the debugger to understand the structures while testing).
>
> Thanks in advance.
>
> Regards
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Extending GREclipse contentassist with XML support

pcohen
Andrew Eisenberg wrote
This does sound like an interesting idea and I do think that many
...
But first, I'd have a discussion on the users list to gauge interest.
Hi Andrew and thanks for the advice. I will ask on the right mailing list.

In fact I managed to get something that could be a "nice" prototype though I think much could be improved in the code, but at least I have something that could be a good starting point in my opinion. I will start to write UnitTests to make me more confident on code changing.
I will ask people on the mailing list and meanwhile I will check with my company if I can share the code - sounds possible according to the policy but I would like to cross check with the legal division to avoid any issue :)

Thanks again