XSD4MXML

| | Comments (0) | TrackBacks (0)
For those of you who want to get some MXML support in FDT I thought I'd share this little tutorial. I can't take credit for this as it was the guys from FDT who pointed this out at recent visit to LFPUG and Adobe MAX Milano way back in 2008. Lets hope we get FDT to support MXML natively so this isn't required but until then here goes. A small caveat, this will probably not work in Flex 4 as I remember them removing the mx namespace for the framework.

First things first - Get Eclipse Ganymede

Why Ganymede? Well since 3.4 Eclipse has overhaulled it's built-in update system to make it way more friendlier when adding new plugins or updating existing ones. First it's easier to access Help » Software Updates and second it tries to resolve all dependencies for you. This is a big one as I remember thinking while writing the Complete Starter Guide tutorial that resolving dependencies is a real pain in the ass. To download the latest version go here and select Eclispe Classic.

Get the Eclipse XML Editor

You will need a better than default XML editor to give you syntax colouring and code highlighting. So we install the Web Tools like so:
  • Help » Software Updates » Available Software Tab
  • Expand Ganymede Update Site
  • Expand Web and Java EE Development
  • Select Eclipse XML Editor
  • Click OK

SoftwareUpdates.gif

Fig A. Help » Software Updates

GanymedeUpdateSite.gif
Fig B. Ganymede Update Site

Eclipse-XML-Editors.gif
Fig C. Ganymede Update Site » Web and Java EE Development

Note: You can also install the HTML/CSS/Javascript editor in exactly the same way as above by selecting Web Developer Tools.

Change Eclipse to support .mxml

Eclipse will need to kow that we want to use the XML Editor for .mxml files so we will have to add this extension to the extensions associated with the Eclipse XML Editor. Do the following:

  • Window » Preferences » General » Content Types
  • Expand the Text node
  • Select XML
  • In the File associations box click on add...
  • Click OK » OK

FileAssocitations.gif

Fig D. Window » Preferences » General » Content Types » File Associations


FileAssociationsb.gif

Fig E. Window » Preferences » General » Content Types » File Associations
» Add

Install XSD schema for MXML

You may have figured this out from the title but that is exactly what xsd4mxml is. It's a googlecode project which was stumbled upon by the FDT guys and the kryptonite for making this whole tutorial work. Go to the location above and download the flex3.xsd from the download page. In Eclipse do the following:

  • Window » Preferences » XML » XMLCatalog
  • Add...
  • Next to the Location input field click on the little folder icon
  • Filesystem... and browse to where you downloaded the xsd file
  • Click OK

XMLCatalog.gif
Fig F. Window » Preferences » XML » XMLCatalog » Add


After selecting it you should now see the Adobe 2006 namespace under User Specified Entries. The result is as follows. Code hinting for MXML.

Result.gif

Fig G. Result of using XSD4MXML in Eclipse + FDT

Remember you won't get code hinting for your own custom components as FDT doesn't parse your files just yet. The XSD file is loaded when you start up Eclipse and then used to lookup code hinting for Flex components.

It's better than nothing!






0 TrackBacks

Listed below are links to blogs that reference this entry: XSD4MXML.

TrackBack URL for this entry: http://www.wezside.co.za/cgi-bin/mt/mt-tb.cgi/53

Leave a comment


Type the characters you see in the picture above.