Using XInclude in the Guidance Package Configuration File
Retired Content |
---|
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. |
You can use XInclude to simplify the guidance configuration file, as GAX supports the XInclude W3C Recommendation. You can create reusable configuration sub-file and include them in the configuration file. For example you can put TypeAlias definition in a separate file and include it multiple time instead of repeating its content multiple times. This would look something like this:
Below is the content of the Types.xml file.
<Types>
<TypeAlias Name="MyEvaluator" Type="MyNS.MyEvaluator, MyAssembly" />
</Types>
This file can be referenced from the Guidance Package Configuration file in the following way.
<GuidancePackage ...>
<Recipes>
<Recipe Name="MyRecipe">
<xi:include href="Types.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<Caption>Does something cool</Caption>
...
</Recipe>
</Recipes>
</GuidancePackage>
Any other part of the configuration file can be placed into a separate file. Most obvious candidates are: set of arguments, actions, or an entire recipe.
When GAX reads the configuration file, it retrieve the content of the included file and merges it with the guidance package configuration file content as if it were typed there.
Nodes from the included file can also be selected for inclusion using the xpointer attribute. For example including only a single type alias from the same Types.xml file above, can be done with the following configuration.
<GuidancePackage ...>
<Recipes>
<Recipe Name="MyRecipe">
<Types>
<xi:include href="Types.xml" xpointer="/Types/TypeAlias[@Name='MyEvaluator']" xmlns:xi="http://www.w3.org/2001/XInclude" />
</Types>
<Caption>Does something cool</Caption>
...
</Recipe>
</Recipes>
</GuidancePackage>
Note that the result of including nodes/documents must be a valid guidance package configuration file according to the XML schema.
More information about XInclude can be found at:
See also
Developing Recipes | Specifying Command Bars | Specifying Bound References | Specifying Unbound References | Gathering Arguments