LoopXML

You can review the details of the loopXML JSP tag.

Description

The loopXML JSP tag loops through a specific repeating element in a source XML.

Note: If your application server only supports up to JSP specification version 1.1, it does not support using jsp:include within a custom JSP tag that contains a body tag. Using the loopXML tag results in a run-time JSP error that indicates "Illegal to flush within a custom tag."

To avoid this run-time error, use the getLoopingElementList() function instead of the loopXML tag. See "JSP Functions for the Console JSP Interface."

Attributes

binding - Required. Path to the element through which you want to loop within the source XML. The repeating element must be one fixed with the at character (" @ ").

name - Optional. Name of the source XML. If this parameter is not used, the value is picked up from the binding. For example, if you specify xml:/Menu/@MenuDescription as the binding, the value for name defaults to Menu. Or in another example, if you specify xml:/mymenu:/Menu/@MenuDescription as the binding, the name defaults to mymenu.

id - Optional. Name of the created YFCElement that holds the element resolved from the binding. If not specified, the Element NodeName pointed to by the binding parameter is used. For example, if the binding is xml:/ItemList/@Item and is not passed, the value for id defaults to Item.

Body

Can contain HTML that is written for each iteration in the loop.

Example

This example shows how the loopXML JSP tag is used to display the list of items in item lookup.

<tbody>
   <yfc:loopXML name="ItemList" binding="xml:/ItemList/@Item" id="item"> 
   <tr> 
      <td class="tablecolumn">
          <img class="icon"  
onclick="setItemLookupValue('<%=resolveValue("xml:item:/Item/@ItemID")%>',
'<%=resolveValue("xml:item:/Item/PrimaryInformation/@DefaultProductClass")
%>','<%=resolveValue("xml:item:/Item/@UnitOfMeasure")%>')" 
value="<%=resolveValue("xml:item:/Item/@ItemID")%>"  
<%=getImageOptions(YFSUIBackendConsts.GO_ICON,"Click_to_select")%> />
      </td>
      <td class="tablecolumn"><yfc:getXMLValue name="item"
binding="xml:/Item/@ItemID"/></td>
      <td class="tablecolumn"><yfc:getXMLValue name="item" 
binding="xml:/Item/PrimaryInformation/@DefaultProductClass"/></td>
      <td class="tablecolumn"><yfc:getXMLValue name="item"
binding="xml:/Item/@UnitOfMeasure"/></td>
      <td class="tablecolumn"><yfc:getXMLValue name="item" 
binding="xml:/Item/PrimaryInformation/@ShortDescription"/></td>
      <td class="tablecolumn"><yfc:getXMLValue name="item"
 binding="xml:/Item/PrimaryInformation/@MasterCatalogID"/></td>
      <td class="tablecolumn"><yfc:getXMLValue name="item"
binding="xml:/Item/@OrganizationCode"/></td>
   </tr>
   </yfc:loopXML> 
</tbody>