Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Dynamic table with strange XML


Level 2
Probably I should write my problem before, instead of asking "part-questions".<br /><br />I have an XML like this:<br /><Root><br /> <Elem1 value="ss"><br /> <Elem2 value="ss2"><br /> <ElemInTable1 value="s" index="0"><br /> <ElemInTable2 value="s" index="0"><br /> <ElemInTable1 value="s" index="1"><br /> <ElemInTable2 value="s" index="1"><br /></Root><br /><br />Explanation: <br />Elements: <br />a) ElemX are normal fields. <br />b) ElemInTableX are elements which represent a table. All elements with the same attribute index are in the same row.<br /><br />I am trying to create a form which will allow me to have an dynamic table (adding and deleting rows), which will fill both attributes ('value' and 'index'). <br />I am out of ideas who to bind fields to textfields, or how to "repair" XML with javascript. Still something does not work correctly.
1 Reply


Former Community Member
Hello,<br />you have to change your XML to smth like this:<br /><br /><?xml version="1.0" encoding="iso-8859-1"?><br /><root> <br /> <Elem1 value="ss"/> <br /> <Elem2 value="ss2"/> <br /> <table1><br /> <ElemInTable1 value="s" index="0"/> <br /> <ElemInTable1 value="s" index="1"/> <br /> </table1> <br /> <br /> <table2><br /> <ElemInTable2 value="s" index="0"/> <br /> <ElemInTable2 value="s" index="1"/> <br /></table2><br /> <br /></root><br /><br />and make this file as source for DataConnection.<br /><br />After that you will be able to bind tables and add instances.