Add Repeating Elements in the Form
It is possible to repeat HTML elements based on collection of multiple XML nodes resulting from an xpath in the source XML.
In most cases, these repeating elements would form 'rows' in a 'table' and each node in collection could be mapped to a HTML row, for example, one 'CatalogItem' in the source XML could be mapped to one tr element.
- An HTML element that would be repeated must be added to the HTML form. This element is not displayed to the user but is used as a reference node that would be cloned at runtime. In the current example, it is simply a HTML row element.
- Each column in the HTML row must have an 'id' attribute that starts with the 'id' of the reference node. Here the reference node is id 'Line' and hence all child elements must have id like 'LineProductID', 'LineProductExtension' and so on.
- The reference node and its child element must have a corresponding entry in XML form.
- The entry in XML form corresponding to reference node must have:
<ID>: set to id of reference node
<InputForm>: set to XPath of repeating XML nodes in source XML document. For example, if <CatalogItem> results in collection, XPath to CatalogItem.
- The entry in XML form corresponding to child element must have,
<ID>: set to id of child element
<InputForm>: set to XPath, which starts with XPath of reference node.
- The entry in XML form corresponding to reference node must have:
- The following example illustrates the procedure.
- In the HTML code, add a sample row:
<table border="1"> <tr id="tableHeaderRow"> <td>ProductID</td> <td>Product Extension</td> <td>Long Desc</td> </tr> <tr id="Line"> <td id="LineProductID"> </td> <td id="LineProductExtension"> </td> <td id="LineProductDescription"> </td> </tr> </table>
- In the XML form, add entries having XPath pointing to location of data for each of the row elements.
<Field> <ID>Line</ID> <InputFrom>/Message/Body/Document/BusinessDocument/CatalogAction/CatalogActionDetails/CatalogItem</InputFrom> <OutputTo></OutputTo> <Value/> </Field> <Field> <ID>LineProductID</ID> <InputFrom>/Message/Body/Document/BusinessDocument/CatalogAction/CatalogActionDetails/CatalogItem/PartNumber/GlobalPartNumber/ProdID/IDNumber</InputFrom> <OutputTo></OutputTo> <Value/> </Field> <Field> <ID>LineProductExtension</ID> <InputFrom>/Message/Body/Document/BusinessDocument/CatalogAction/CatalogActionDetails/CatalogItem/PartNumber/GlobalPartNumber/ProdID/IDExtension</InputFrom> <OutputTo></OutputTo> <Value/> </Field> <Field> <ID>LineProductDescription</ID> <InputFrom>/Message/Body/Document/BusinessDocument/CatalogAction/CatalogActionDetails/CatalogItem/PartNumber/GlobalPartNumber/ProdDescription</InputFrom> <OutputTo></OutputTo> <Value/> </Field>
- In the HTML code, add a sample row:
Copyright © Cloud Software Group, Inc. All rights reserved.