tags:

views:

68

answers:

2

I use VIM as my text editor and I edit a lot of XML and WSDL files.

WSDL files have an XSD section. Is there some VIM plugin I can use to traverse the XSD types? i.e., if I have the following line and the caret is where the '|' sign is:

<xsd:element minOccurs="0" name="FooName" type="Magic|FooType"/>

and I press Ctrl+Alt+Foo (or some other magic combo) it will get me to the definition of MagicFooType, i.e.:

<xsd:complexType name="MagicFooType">

I couldn't find how to use ctags for this and all the other plugins that I could find are for imperative languages (i.e. Java). Is there some plugin/script to do the job?

+2  A: 

gd ("go to declaration") is not aware of the XML format but might do the job in this case, assuming the XSD section is at the top of the WSDL.

ngn
Thanks, a bit better than manually searching the type's name, but as you said, it's not aware of xml/xsd and awkward to use on large files.
maayank
+2  A: 

I have been watching this thread for a bit and wondering this myself as I am a VIM user and work with a lot of very large XML files and associated XSD's, XSLT's and XQuery files, all of which could benefit from this sort of thing, as I am sure you can imagine.

After some research this can be done with ctags, but there is nothing out there at the moment which will create the ctags file for it. Essentially a ctag looks like this:

{tagname}<tab>{tagfile}<tab>{tagaddress}

Because the tagaddress is an ex mode command it can take you anywhere in a particular file to land right on the definition.

Basically all we would need to do is create a script which would run through the WSDL (or XSD, or whatever) and, knowing the location of the tag and file, create the appropriate lines in a ctags file to map all of the definitions. Sounds like a fun and useful little project.

Sorry that this isn't exactly a complete answer, but it is possible to do with ctags and will give you the robustness you and looking for.

Tim C
Sadly it seems the most practical way.Well, who knows, maybe this summer between another two projects :)If I'll take on this in 1 month time, would you like to collaborate?
maayank
I would be glad to yes. In fact I have already discussed this with a few of my coworkers and we all think this would be a good idea. Feel free to contact me offline and we might be able to discuss collaboration ideas.
Tim C
@Tim C, I'm unable to see your email address and I can't find any other method of personal communication on SO, so please send me an email to [email protected] (or leave it here, whatever suits you :)
maayank