logo       

nested table with xmlc: msg#00056

java.enhydra.general

Subject: nested table with xmlc

hi,

I have searched the list and found DOMTableRow from Rechard Kunze and
try it. It works well when there are only two layer loops, but I can not
make it work when the loops are more than two layers.


For example:

<table width="100%" border="1">
<tr id="outTemplate">
<td width="28%" height="118"><span id="aText">A</span></td>
<td width="72%"><table width="100%" border="1">

<tr id="innerTemplate">
<td width="47%"><span id="innerText">B</span></td>
<td width="53%"><table width="100%" border="1">
<tr id="mostInnerTemplate">
<td><span id="mostInnerText">C</span></td>
</tr>
<tr class="discardMe">
<td>C</td>

</tr>
</table></td>
</tr>
<tr class="discardMe">
<td height="45">B</td>
<td>&nbsp;</td>
</tr>
</table></td>

</tr>
<tr class="discardMe">
<td height="105">A1</td>
<td>the same above</td>
</tr>
</table>

And my code like this:

Element outerTemplate = page.getElementOuterTemplate();
Element innerTemplate = page.getElementInnerTemplate();
Element mostInnerTemplate = page.getElementMostInnerTemplate();

while (haveOuterData()) {
// Create a new row
DOMTableRow row = new DOMTableRow(outerTemplate, innerTemplate);
while (haveInnerData()) {
// Fill in the template
page.setTextInnerText(getSomeText());
DOMTableRow row1 = new DOMTableRow(innerTemplate, mostInnerTemplate);
while(haveMostInnerData()) {
page.setTextMostInnerText(.....);
row1.addCell(mostInnerTemplate.cloneNode(true));
}

// add a copy of the template to the table row
row.addCell(innnerTemplate.cloneNode(true));
}
}
// Don't forget to remove the original outer template
outerTemplate.getParentNode().removeChild(outerTemplate);


Any problem? Any help?

Thanks in advance!

linuxman


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise