Using Eclipse Web Tools XML editor for fusebox xml.cfm files

I've been looking for a decent XML editor for Eclipse since I started working with Fusebox 5.

My main requirements are:

  • Validation of XML syntax
  • Validation of XML against a DTD
  • Location aware content assist - that only prompts with elements that are actually valid for the current location

I tried a few plugins

  • Oribe XML - Not bad, validates against DTD, provides basic content assist, but not location aware
  • I'm Impressed :)

  • Aptana Plugin - this offers an excellent all round web dev IDE for CSS, HTML, Javascript etc. - and also comes with an XML editor. Unfortunately this seems a little lacklustre in comparison to the other tools - no content assist or DTD validation as far as I could see

Reading through the Transfer Documentation, I noticed a link to the Web Tools Platform for Eclipse.

I was amazed - this seems to offer so much out of the box - I'm surprised I hadn't heard more hype about it.

To install, its simply a matter of going to the Help > Software Updates > Find and Install menu item, and selecting Callisto Discovery Site. This gives a huge list of available plugins - including the WTP. Selecting this prompts that there are other dependencies - clicking the Select Required selects them for you.

It is common practice within fusebox, to suffix the fusebox.xml and circuit.xml files with .cfm - this does prevent eclipse from associating the files with the XML editor.

This can be achieved by:

  • Selecting General > Content types from the Preferences dialogue box
  • Selecting Text > XML from the Content types: tree
  • Click the Add... button, and adding the File associations &quo;fusebox.xml.cfm&quo; and &quo;circuit.xml.cfm&quo;
  • Click the File Associations link at the top of the dialogue box
  • Click the top Add... button, and add the &quo;fusebox.xml.cfm&quo; and &quo;circuit.xml.cfm&quo; file types
  • Select each of the file types in turn, and the associated editors should appear in the Associated Editors list at the bottom.
  • Click on XML Editor, and then click the Default button

Now fusebox.xml.cfm and circuit.xml.cfm should open with the WTP XML editor by default.

This offers all my specified features, plus a "Design" view - unfortunately this seems to load by default - but its no problem to click the tab and get the Source view.

NB In order for DTD validation and content assist to operate, there must be a reference to the Doctype at the top of the XML document.

I believe the reference DTD's are located at http://www.fusebox.org/fusebox.dtd and http://www.fusebox.org/circuit.dtd

UPDATE: The files available from http://www.fusebox.org/ are not the latest - the latest DTD's should be included in the framework download, or can be downloaded directly from the repository: http://trac.fuseboxframework.org/fusebox/browser/framework/trunk/fusebox.dtd?format=raw and http://trac.fuseboxframework.org/fusebox/browser/framework/trunk/circuit.dtd?format=raw

I have a copy hosted locally on my development machine, so that the XML editor is not repeatedly retrieving the document from the internet - which can be a problem if i am working offline:

<!DOCTYPE circuit SYSTEM "http://localhost/dtds/circuit.dtd">

Comments
Nick Tong's Gravatar Nice work Dan.
# Posted By Nick Tong | 02/05/07 13:57
Nick Tong's Gravatar Another way to add the editor by default is:
1. window | preferences
2. Editors
3. File Associations
4. Select Add and enter *.cfm.xml
5. Add the XML editor
# Posted By Nick Tong | 02/05/07 14:08
Dan Lancelot's Gravatar Hi Nick,

With regards to the comments, I did try that (although not with this particular XML editor) - and found that I had to add the explicit file names rather than just the *.xml.cfm in order for eclipse to pick up the association...
# Posted By Dan Lancelot | 02/05/07 15:20
BlogCFC was created by Raymond Camden. This blog is running version 5.5.1, hosted by TalkWebSolutions.