Circuit XML Grammar

Fusebox

(Reprinted and modified with permission from "Discovering Fusebox 4, Second Edition" by John Quarto-vonTividar)

Overview

Fusebox 4/5 includes an XML-based language with its own grammar. Fortunately for those of us who preferred Algebra to English in school, the Fusebox grammar is exceedingly simple, containing only what might best be described as "verbs"--and only five verbs at that--plus a smattering of attributes and helper constructs. Therefore, this will be a short, albeit absolutely critical, chapter towards mastering Fusebox.

This grammar is used in an application's fusebox.xml file and circuit.xml file for each circuit in the application. Thus, these commands can occur inside the fusebox.xml's globalfuseaction element, or within a circuit.xml's fuseaction, prefuseaction or postfuseaction elements and no where else.

By restricting the size of the available grammar and its use within the above-mentioned files' elements, the developer will more correctly keep program logic where it belongs---in fuses rather than in fuseactions.

By specifying the application architecture in XML, we have a cross-platform standardized mechanism for creating language-independent Fusebox applications. That is to say, if you now complete a Fusebox project in, say, ColdFusion, then porting your application to PHP consists only of translating the application's fuses into PHP and dropping in a set of Fusebox compliant PHP core files. That portability translates into increased development speed and longevity, leveraging of existing code bases, project flexibility, and higher return on investment for commercial software development using Fusebox.

The Builtin Verbs

Gotchas

XML looks a lot like traditional HTML. It has open and close tags, lists of attributes for tags, nested parameters, and so forth. XML syntax is much less forgiving however. It equires strict adherence to the syntax rules, unlike HTML which tends to be more forgiving. To avoid errors:

  1. All opened tags must be closed
  2. You cannot overlap nested tags
  3. Comments must use the two-dash HTML style <!- comment -> (not the three dash Coldfusion style <!-- comment -->)
  4. You must use URL entities when using the ampersand and opening and closing angle brackets.(ampersand: & <: > >: <)

Problems in your XML will not be reported by Fusebox, use an XML validator.

Summary

This has summarized the Fusebox grammar, consisting of five "verbs" (include, set, xfa, do, relocate) and two "helper constructs" (if and loop). Armed with this small but flexible grammar you are now ready to build powerful Fusebox applications that are modular, language-independent, and highly maintainable.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.