Defining fragments

A fragment is a piece of XML code that is defined on one place, and which can be re-used elsewhere.

Ideally, you should put fragments at the start of an XML configuration file. They can go anywhere, but this may result in slower parsing.

Here is an example of a fragment.

<Configuration>
   <Fragment Name="DoubleDebug" Param1="Default1" Param2="Default2" Param3="PR_Init" >
      <Component Type="SYS_DebugComment_FromXML" Comment="{Param1}" Section="Param3" />
      <Component Type="SYS_DebugComment_FromXML" Comment="{Param2}" Section="Param3" />
   </Fragment>

   <!-- more code -->
</Configuration>

The code above declares a fragment called DoubleDebug. This takes two parameters and inserts two debug comments into the XML. Note the following:

Using fragments

To instantiate the fragment definition shown above you could use the following:

<Page Name="HelloWorld>
   <FragmentInclude Name="DoubleDebug"
      Param1="Hello"
      Param2="World"
   </FragmentInclude>
</Page>

Which would expand to the following:

<Component Type="SYS_DebugComment_FromXML" Comment="Hello" Section="PR_Init" /> 
<Component Type="SYS_DebugComment_FromXML" Comment="World" Section="PR_Init" /> 

Note how the section variable has been filled in with the default section value.