1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
|
<html>
<head>
<link href="../../style.css" rel="stylesheet" type="text/css">
</head>
<body>
<p class="heading1">
Table structure in documents
</p>
<p>
As mentioned <a href="../../topic16/topic74/topic78.htm">previously</a>,
Documents are modeled by <font face="'Courier New',Monospaced,Monospace">
Elements</font> 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.
</p>
<p>
In HTML a table is coded like this
</p>
<p style=" text-align:left; font-family:'Courier New',Monospaced,Monospace; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-bottom:0pt; background-color:#ffffff; margin-top:6pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"><table> </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:10pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"><tr> </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:20pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"><td> </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:30pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"><p> </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:40pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2">row 1, column 1 </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:30pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"></p></font><font size="2">
</font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:20pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"></td> </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:20pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"><td> </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:30pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"><p> </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:40pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2">row 1, column 2 </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:30pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"></p></font><font size="2">
</font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:20pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"></td> </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:10pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"></tr> </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:10pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"><tr> </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:20pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"><td> </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:30pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"><p> </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:40pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2">row 2, column 1 </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:30pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"></p></font><font size="2">
</font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:20pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"></td> </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:20pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"><td> </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:30pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"><p> </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:40pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2">row 2, column 2 </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:30pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"></p></font><font size="2">
</font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:20pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"></td> </font>
</p>
<p style=" text-align:left; font-family:Arial,Sans-Serif; font-style:normal; text-decoration:none; font-size:12pt; font-weight:normal; color:#000000; margin-left:10pt; background-color:#ffffff; margin-top:0pt;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"></tr> </font>
</p>
<p style=" font-family:'Courier New',Monospaced,Monospace; font-size:12pt; color:#000000; margin-top:0pt; background-color:#ffffff; text-decoration:none; text-align:left; font-style:normal; font-weight:normal;" class="code">
<font face="'Courier New',Monospaced,Monospace" size="2"></table> </font>
</p>
<p>
</p>
<p>
Rendered inside a document above HTML code might show as follows
(display differs depending on style sheet settings)
</p>
<p>
</p>
<table style=" width:80%;">
<tr>
<td style=" width:50%;" valign="top">
<p class="table">
row 1, column 1
</p>
</td>
<td style=" width:50%;" valign="top">
<p class="table">
row 1, column 2
</p>
</td>
</tr>
<tr>
<td style=" width:50%;" valign="top">
<p class="table">
row 2, column 1
</p>
</td>
<td style=" width:50%;" valign="top">
<p class="table">
row 2, column 2
</p>
</td>
</tr>
</table>
<p>
</p>
<p>
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.
</p>
<p>
</p>
<p>
<img src="../../images/elemTree.jpg" width="408" height="420">
</p>
<p>
</p>
<p>
To manipulate a table or its parts, an application has to work on that
element strucutre and its attributes.
</p>
<p>
<b>Note: </b>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.
</p>
</body>
</html>
|