The Dopefly Tech Blog

« The Dopefly Tech Blog Main page

Fusebox 4.1 DTDs (and how to use them!)

posted under category: Fusebox on November 17, 2005 at 1:00 am by Nathan

Another thing I've been playing with lately is getting tag insight (you know, those little drop-downs while you type) to work on fusebox.xml and circuit.xml files. I'm no kind of Eclipse hacker, so the easy way to do it is make a DTD file for the XML editor you may already have in Eclipse.

Mmmkay... how does that help me? Glad you asked!

First, do you have an XML editor? You'll need one for this exercise. I prefer the WST XML editor from the Eclipse org., and it's easy for you to get. Go to your auto-update tool (under the help menu), and search the Eclipse update site for new plugins. Locate the WST (Web Standards Tools), select it and hit the 'select required' button. Now install and restart.

Next, you need to add the DTDs to the local DTD registry. What I did was hit the Eclipse prefs, and found the XML Catalog section under Web and XML. Then I added 2 user specified entries, for fusebox.xml and circuit.xml, pointed them to the appropriate DTD file on my local disk, made them a Public ID key type and gave the key a name (I used circuit.dtd and fusebox.dtd).

Next, in my XML files, I added this doctype to my circuits:
<!DOCTYPE fusebox:circuit PUBLIC "circuit.dtd" "circuit.dtd">
And to my Fusebox.xml:
<!DOCTYPE fusebox PUBLIC "fusebox.dtd" "fusebox.dtd">
I wish I knew what that all meant, but i'm ignorant out of lack for good books and time to read them ;)

And there it is. Restart Eclipse (for good measure) and it should all just work!
All you need is the DTDs to try it yourself, so here you go:

Fusebox 4.1 Document Type Definitions

These were copied and modified from the ones by Sandy Clark - Sandy, hope you don't mind. Good work getting it started, thanks!

Hope you all like. Let me know if any of you have any updates to these, as it's my first real stab at DTDs.