wiki:rp_xml_ele_loader

Version 1 (modified by mmc, 19 years ago) (diff)

updated to be consistent with "zoo" example

<loader>

A loader is used to load values into the interface from example files. The example files have the same format as the tool.xml file that they are being loaded into. In fact, they can be generated by running the tool and saving the output run.xml file. In you look in the example files, you'll see that each one also has an <about> section with a label and a description. These show up in the loader control.

  <loader>
    <about>
      <label>Example</label>
      <description>Use this to load examples.</description>
    </about>
    <example>*.xml</example>
  </loader>

The example files sit in a directory named examples in the same directory as the tool.xml file. You can include any number of <example> tags. Each one contains a file name or a glob-style (shell-style) matching pattern for files that should be included in the loader. If there are no <example> tags, the default pattern *.xml is assumed.

The Change both example file looks like this:

<?xml version="1.0"?>
<run>
<about>
  <label>Change both</label>
  <description>This example changes both inputs, #1 to "first" and #2 to "second"</description>
</about>

<tool>
  <title>loader</title>
</tool>
<input>
  <loader>
    <about>
      <label>Example</label>
      <description>Use this to load examples.</description>
    </about>
    <example>*.xml</example>
  </loader>

  <string id="one">
    <about>
      <label>Input #1</label>
    </about>
    <current>first</current>
  </string>
  <string id="two">
    <about>
      <label>Input #2</label>
    </about>
    <current>second</current>
  </string>
</input>
</run>

Note that it has <current> values for each of the <string> inputs.


The Change first example file looks like this:

<?xml version="1.0"?>
<run>
<about>
  <label>Change first</label>
  <description>This example changes only the first input to the value "hello"</description>
</about>

<tool>
  <title>loader</title>
</tool>
<input>
  <loader>
    <about>
      <label>Example</label>
      <description>Use this to load examples.</description>
    </about>
    <example>*.xml</example>
  </loader>

  <string id="one">
    <about>
      <label>Input #1</label>
    </about>
    <current>hello</current>
  </string>
</input>
</run>

This is almost the same as the first, but it has only string input. The second one is missing, and therefore the second string is not changed when this example is loaded.