【发布时间】:2021-12-16 04:44:12
【问题描述】:
如果我们得到<gridSpan val="4"/>,则在“entry”元素中创建@namest 和@nameend 属性。
注意: May be gridSpan element will appear in 3rd entry then @namest and @nameend will be come in the third entry
then output should be <entry namest="c1" nameend="c4">
<gridSpan val="3"/>
then output should be <entry namest="c2" nameend="c3">
<gridSpan val="2"/>
then output should be <entry namest="c1" nameend="c2">
Xml:
<tbl>
<tblPr>
<tblW w="9885" type="dxa"/>
</tblPr>
<tblGrid>
<gridCol w="1488"/>
<gridCol w="3100"/>
<gridCol w="3267"/>
<gridCol w="2021"/>
</tblGrid>
<tr>
<tc><p>Content here</p></tc>
<tc><p>content here</p></tc>
<tc>content here</tc>
<tc>contenet</tc>
</tr>
<tr>
<tc>
<tcPr>
<!-- May be gridSpan element will appear in 3rd entry then @namest and named will be come in the third entry
<gridSpan val="4"/>
</tcPr>
<p>Content here</p>
</tc>
</tr>
</tbl>
输出:
<table>
<tgroup cols="4">
<colspec colname="c1" colnum="1"/>
<colspec colname="c2" colnum="2"/>
<colspec colname="c3" colnum="3"/>
<colspec colname="c4" colnum="4"/>
<tbody>
<row>
<entry>Content here</entry>
</row>
<row>
<entry>Content here</entry>
</row>
<row>
<entry>Content here</entry>
</row>
<row>
<entry>Content here</entry>
</row>
</tbody>
</tgroup>
</table>
预期输出:
<table>
<tgroup cols="4">
<colspec colname="c1" colnum="1"/>
<colspec colname="c2" colnum="2"/>
<colspec colname="c3" colnum="3"/>
<colspec colname="c4" colnum="4"/>
<tbody>
<row>
<entry>Content here</entry>
</row>
<row>
<entry>Content here</entry>
</row>
<row>
<entry>Content here</entry>
</row>
<row namest="c1" nameend="c4">
<entry>Content here</entry>
</row>
</tbody>
</tgroup>
</table>
【问题讨论】: