XML for application planning???

I am in the process of converting a Fusebox 5.1 application to an MVC implementation.

This is a relatively complex task, as I am also wanting to split the application into 2 - in order to allow shared functionality to be implemented once, and create another instance of the application with a different controller, and some unique functionality.

I was a little stumped at first to know how to visualise the folder structure for the application - I started laying it out within Visio - but quickly realised that this was not sustainable - Visio is great for visualising many aspects of an application design - but its not ideal for representing a large tree structure.

Then I thought - what about using XML - XML is great for representing hierarchical structures - and using the design view within the Eclipse WTP XML editor, its very quick to add, edit, move, and duplicate elements.

[More]

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">

BlogCFC was created by Raymond Camden. This blog is running version 5.5.1, hosted by TalkWebSolutions.