20.2 Introduction to Distribution XML Files

This section discusses the use of XML files related to distribution:

20.2.1 The distribution.dtd File

When you create a distribution XML file, you follow the syntax defined in the distribution.dtd file located in the following directory on both Windows and UNIX:

ORACLE_HOME\reports\dtd

As you look through the following sections, it may be useful to you to print the distribution.dtd file and refer to it as you review the descriptions of the elements and attributes.

Note:

Information provided in the distribution XML file is case-sensitive. You must preserve case of various elements and attributes as specified in the distribution.dtd file.

The distribution.dtd file lists all elements that are valid within a distribution XML file. Each of these elements have attributes. Attributes that come with default values need not be specified, unless you wish to override the default.

You can create a dynamic distribution by introducing variable values into many different attributes. Variable values reference columns that are present in the report that is using the distribution XML file.

20.2.2 Using Variables Within Attributes

You can use variables within attributes by entering &column_name or &<column_name> in the place of a static value.

Note:

The ampersand (&) and less-than symbol (<) have specific meanings in XML, but they are also required symbols for certain Oracle Reports command line options (for example, lexical parameters require the ampersand symbol). To avoid conflict with the XML meanings of these symbols when you set up variables, specify the encoded version of the ampersand (&amp;) and less-than and greater-than symbols (&lt; and &gt;). For example:

Here is what the variable looks like improperly coded in an XML file:

<mail id="a1" to="&<manager>@mycompany.com" …

Here is what the variable looks like properly coded in an XML file:

<mail id="a1" to="&amp;&lt;manager&gt;@mycompany.com" …>

There is no special requirement for the greater-than symbol (>) used with variables, but for consistency, we recommend that you use the encoded version (&gt;).

The variable syntax you use depends on whether the value is expressed by itself or in combination with other values or strings. For example, a value for a to attribute in a mail element might be expressed as either:

<mail id="a2" to="&amp;email" …>

or

<mail id="a3" to="&amp;&lt;first_name&gt;.&amp;&lt;last_name&gt;@myco.com …>

In the first example (id="a2"), the variable's referenced column (email) contains a full e-mail address and does not require additional information. The second example (id="a3") uses a combination of variable values (first_name and last_name) and static text to construct an e-mail address (static text is the period after first_name and @myco.com). In both cases, you will get dynamic e-mail addressing. The example you use will depend on whether the variable contains all the information you need or requires additional information in order to be complete.

For more complex layouts, you can also reference report columns you created with PL/SQL formulas. For example, in your report you may define the PL/SQL column:

PL/SQL formula CF_MAILID: return(:first_name||'.'||:last_name)

You'd reference this column in the distribution XML file as:

to="&amp;&lt;CF_MAILID&gt;@mycompany.com"