I have the below XML (table):
<table-wrap id="tbl4" position="float">
<label>Table E3</label>
<caption>
<p></p>
</caption>
<alternatives>
<graphic xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:href="EEMCS-01-2021-001110.tif"/>
<table frame="hsides">
<colgroup>
<col align="left"/>
<col align="left"/>
<col align="left"/>
<col align="left"/>
<col align="left"/>
<col align="left"/>
<col align="left"/>
</colgroup>
<thead>
<tr>
<th rowspan="2" align="left">1</th>
<th colspan="4" align="center">2</th>
<th rowspan="2" align="center">3</th>
</tr>
<tr>
<th align="center">4</th>
<th align="center">5</th>
<th align="center">6</th>
<th align="center">7</th>
<th align="center">8</th>
</tr>
</thead>
<tbody>
<tr>
<td>9</td>
<td rowspan="2">10</td>
<td>11</td>
<td>12</td>
<td>13</td>
<td>14</td>
<td rowspan="2">15</td>
</tr>
<tr>
<td>16</td>
<td>17</td>
<td>18</td>
<td>19</td>
<td>20</td>
</tr>
<tr>
<td>21</td>
<td colspan="2">22</td>
<td rowspan="2">23</td>
<td colspan="2">24</td>
<td>25</td>
</tr>
<tr>
<td>26</td>
<td>27</td>
<td>28</td>
<td>29</td>
<td>30</td>
<td>31</td>
</tr>
<tr>
<td rowspan="2">32</td>
<td colspan="2">33</td>
<td>34</td>
<td colspan="2">35</td>
<td rowspan="2">36</td>
</tr>
<tr>
<td>37</td>
<td>38</td>
<td>39</td>
<td>40</td>
<td>41</td>
</tr>
</tbody>
</table>
</alternatives>
</table-wrap>
I want to validate missing tr or td in each based on colspan and rowspan I would like to explain colspan and rowspan conditions:
- If colspan="2" in a td, it means two column entries are merged (spanned) so the count of td in that row will be decreased
- If rowspan="2" in a td, it means two-row entries are merged (spanned) so the count of td in next row will be decreased
Is there is an additional column or row in the table I have to throw it as an error.