| | 1 | = Overview = |
| | 2 | Among the productivity enhancements added to !ModelGlue 3.2 is a feature designed to make working with your !ModelGlue XML config files much easier. !ModelGlue now includes an XML schema file that allows your IDE to provide node proposals as you are building your XML files and validation to ensure that your XML files are structured correctly. |
| | 3 | |
| | 4 | == Node Insight == |
| | 5 | Because XML is a structured language, configuring your IDE to apply the schema to your XML configuration files will allow it to offer suggestions for nodes allowed based on where you are in your XML file. This can be especially helpful to remind you what nodes are allowed to be inserted inside the node where you are currently working. |
| | 6 | |
| | 7 | In figure 1, the IDE is displaying the list of child nodes that are allowed inside an <event-handler> node. Selecting a suggested node from the popup reduces the amount of typing required which in turn reduces the opportunities for a misspelling in your config file that will have to be debugged later. |
| | 8 | |
| | 9 | == Validation == |
| | 10 | Once you have edited your XML file, you can have your IDE validate its structure against the schema to ensure that there are no syntactic or structural errors. |
| | 11 | |
| | 12 | In figure 2, the IDE is alerting us to a syntax error in our <controller> node (note the additional set of double quotes at the end). |
| | 13 | |
| | 14 | Figure 3 shows a validation error resulting from incorrect structure within our XML file. A <view> node is not valid inside a <broadcasts> node. When XML file is validated, the IDE draws our attention to this right away, saving time trying to run the application and then having to debug the error. |
| | 15 | |
| | 16 | = Getting Started = |
| | 17 | The first step to using the XML schema is to tell your XML editor that it should be used. This is done by changing the top level node of the !ModelGlue XML config file slightly. The root <modelglue> node should be changed to look like this: |
| | 18 | |
| | 19 | {{{ |
| | 20 | <modelglue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | 21 | xsi:noNamespaceSchemaLocation="http://www.model-glue.com/schema/gesture/ModelGlue.xsd" > |
| | 22 | }}} |
| | 23 | |
| | 24 | The latest version of the schema file for !ModelGlue 3 (Gesture) is hosted on the !ModelGlue web site at the address listed in the noNamespaceSchemaLocation attribute above. |
| | 25 | |
| | 26 | Each IDE has its own configuration method for enabling XML files to be validated by the schema files. Since they are both built on top of Eclipse, !ColdFusion Builder (1 or 2) and CFEclipse can be configured the same way. |
| | 27 | |
| | 28 | '''NOTE: The XML editor bundled with !ColdFusion Builder does not recognize XML schema files. You MUST use an alternate XML editor such as the one provided in the [http://www.eclipse.org/webtools/ Eclipse Web Tools Project] in order to take advantage of this feature''' |