To specify a Map property, you use the item element, set the is-multi attribute to true, and use the map-iteration-type attribute to specify how to output the Map entries. If the Map values are primitives or Strings, set map-iteration-type to wildcard, as in this example:

<item property-name="personalData" is-multi="true" map-iteration-type="wildcard">
  <text-properties>
    <property name="*"/>
  </text-properties>
</item>

In the XHTML output, the Map keys are treated as subproperties of the Map property, and the Map values are treated as the values of these subproperties. All of the Map entries are included in the output. So, for example, the output from the definition file entry shown above might look like this:

<div class="atg:role:personalData.firstName" id="1">Fred</div>
<div class="atg:role:personalData.age" id="2">37</div>
<div class="atg:role:personalData.height" id="3">68</div>

If you want to output only a subset of the Map entries, explicitly specify the keys to include, rather than using the wildcard character (*). For example:

<item property-name="personalData" is-multi="true" map-iteration-type="wildcard">
  <text-properties>
    <property name="firstName"/>
    <property name="height"/>
  </text-properties>
</item>
Maps of Repository Items

If the Map values are repository items, set map-iteration-type to values, and specify the properties of the repository item that you want to output. For example, suppose you want to index a productInfos Map property whose keys are product IDs and whose values are productInfo items:

<item property-name="productInfos" is-multi="true" map-iteration-type="values">
  <text-properties>
    <property name="displayName"/>
    <property name="size"/>
  </text-properties>
</item>

The output will include displayName and size tags for each productInfo item in the Map. In this case, the Map keys are ignored, the properties of the repository items are treated as subproperties of the Map property, and the values of the items are treated as the values of the subproperties. The output looks like this:

<div class="atg:role:productInfos.displayName" id="1">Funny hat</div>
<div class="atg:role:productInfos.size" id="2">8</div>
<div class="atg:role:productInfos.displayName" id="3">Clown shoes</div>
<div class="atg:role:productInfos.size" id="4">14</div>

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