Table structure in documents

As mentioned previously, Documents are modeled by Elements which are hierarchically linked according to the content structure in the document. To manipulate a table structure it is necessary to know how a document models HTML code for a table.

In HTML a table is coded like this

<table>

<tr>

<td>

<p>

row 1, column 1

</p>

</td>

<td>

<p>

row 1, column 2

</p>

</td>

</tr>

<tr>

<td>

<p>

row 2, column 1

</p>

</td>

<td>

<p>

row 2, column 2

</p>

</td>

</tr>

</table>

Rendered inside a document above HTML code might show as follows (display differs depending on style sheet settings)

row 1, column 1 | row 1, column 2
row 2, column 1 | row 2, column 2

The element strucutre to be generated inside a document has to be built similar to the HTML code above. Above table viewed with the ElementTree class in SimplyHTML would produce a view such as the following.

To manipulate a table or its parts, an application has to work on that element strucutre and its attributes.

Note: To find out or try how a document's element structure look like, SimplyHTML's ElementTree function is quite helpful. It shows a window as shown with a tree having a node for each element in the element structure of the currently shown document. All element attributes are shown next to each tree node.