The following examples illustrate typical XML template patterns used in scenario grammar elements.

Actions
<sequence id="action-myAction">
  ...
  <xml-template>
    <action-name>myAction</action-name>
    <apply-xml-templates/>
  </xml-template>
  ...
</sequence>

The above XML template will cause the PDL fragment <action-name>myAction</action-name> to be associated with this custom action. The embedded <apply-xml-templates/> element specifies that the sequence’s children will parse and generate their own XML following the <action-name> element. (Note: the enclosing <action> element is automatically generated by the scenario editor and requires no template).

Events
<sequence id="event-message-MyProject.MyEvent">
  ...
  <xml-template>
    <event-name>MyProject.MyEvent</event-name>
    <apply-xml-templates/>
  </xml-template>
  ...
</sequence>

Similarly to the action example, the XML template here provides an <event-name> element to be generated with an enclosing <event> element.

Conditions
<sequence id="condition-myCondition">
  ...
  <xml-template>
    <filter operator="myCondition">
      <apply-xml-templates/>
    </filter>
  </xml-template>
  ...
</sequence>

The XML template here provides a <filter> element to be generated with an enclosing <condition> element. Note that the operator attribute must correspond to the condition name, and that the positioning of <apply-xml-templates/> causes the sequence’s children to be generated within the <filter> PDL element, not after it.

Literal Constants and Token Constants
<literal>
  <xml-template>
    <action-param name="logInteger">
      <constant><apply-xml-templates/></constant>
    </action-param>
  </xml-template>
  <default><value type="java.lang.Integer">1</value></default>
</literal>

In this typical pattern, a literal is associated with an XML template that specifies a <constant> PDL element. The <apply-xml-templates/> element is positioned such that the literal’s value will be generated within the <constant> tag, and its type will be attached to that tag as an attribute.

A similar technique applies to tokens that represent constants.

Tokens for PDL Fragment Choices
<token>
  <xml-template>
    <jndi-property>
      <jndi-url>dynamo:/atg/dynamo/service/CurrentDate</jndi-url>
      <property-name>timeAsDate</property-name>
    </jndi-property>
  </xml-template>
  <description>now</description>
</token>

In this pattern, a token is not associated with any value, but its XML template serves to generate a particular PDL fragment outright, without variation. Because the token has no value, the <apply-xml-templates/> element is not used in the template.


Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved. Legal Notices