列表与复杂表格错误
本頁內容尚未翻譯。
列表(<ul>/<ol>)与复杂表格(<table>)对子元素类型、表头坐标对齐、列宽数量以及矩形网格覆盖有严格校验。本页汇总全部列表与复杂表格相关的 XmlWikiConversionError。
类别总览
| 错误消息模式 | 错误类型 | 触发阶段 |
|---|---|---|
Unexpected text directly inside a list container. | XmlWikiConversionError | XML 解析 |
Unexpected trailing text after a list child element. | XmlWikiConversionError | XML 解析 |
Nested list must follow a list item. | XmlWikiConversionError | XML 解析 |
Unsupported tag <tag> inside list. | XmlWikiConversionError | XML 解析 |
Nested tables are not supported inside table cells. | XmlWikiConversionError | XML / JSON 解析 / 模型校验 |
Unsupported table header mode '<headerMode>'. | XmlWikiConversionError | XML 解析 / 模型校验 |
Complex tables must contain at least one <tr>. | XmlWikiConversionError | XML 解析 |
Row-level width is not supported; use the table widths attribute instead. | XmlWikiConversionError | XML 解析 |
Unexpected text directly inside a table row. / Unexpected trailing text inside a table row. | XmlWikiConversionError | XML 解析 |
Unsupported tag <tag> inside <tr>. | XmlWikiConversionError | XML 解析 |
Table header mode '<headerMode>' conflicts with cell at row <r>, column <c>. | XmlWikiConversionError | XML 解析 |
Complex tables must contain at least one column. / Complex tables must contain at least one row and one column. | XmlWikiConversionError | XML 解析 / 模型校验 |
Complex tables require a chapter size to derive default widths. | XmlWikiConversionError | XML 解析 |
Unsupported chapter size '<chapterSize>' for default table widths. | XmlWikiConversionError | XML 解析 |
Table widths count <n> does not match logical column count <m>. | XmlWikiConversionError | XML 解析 |
Complex table column widths length <n> does not match column count <m>. | XmlWikiConversionError | 模型校验 |
Table width '<part>' for column <n> is not numeric. | XmlWikiConversionError | XML 解析 |
Table column <n> width <w> must be a positive number. / Complex table column <n> width <w> must be a positive number. | XmlWikiConversionError | XML 解析 / 模型校验 |
Expected integer for <location>. / Expected positive integer for <location>. | XmlWikiConversionError | XML 解析 |
Complex table cell positions must be non-negative. | XmlWikiConversionError | 模型校验 |
Complex table cell spans must be positive integers. | XmlWikiConversionError | 模型校验 |
Complex table cell row span exceeds the table bounds. / Complex table cell column span exceeds the table bounds. | XmlWikiConversionError | 模型校验 |
Complex table contains uncovered grid positions. | XmlWikiConversionError | 模型校验 |
Invalid table cell id '<cellKey>'. / Unknown table cell position '<cellKey>'. | XmlWikiConversionError | JSON 解析 |
列表容器直接文本、尾随文本、嵌套顺序与非法子元素
包含四条消息:
-
Unexpected text directly inside a list container. -
Unexpected trailing text after a list child element. -
Nested list must follow a list item. -
Unsupported tag <tag> inside list. -
错误类型:
XmlWikiConversionError -
问题原因:
<ul>或<ol>内直接出现了非空白文本、包含了<li>/<ul>/<ol>之外的元素,或者把嵌套子列表写在了第一个<li>之前。
错误写法:
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<ul>
<ul><li>没有前置列表项</li></ul>
</ul>
</description>
</sklandDocument>修正写法:先写父级 <li>,把子列表放进该 <li> 内部(推荐标准写法)。
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<ul>
<li>
父级列表项
<ul>
<li>子级列表项</li>
</ul>
</li>
</ul>
</description>
</sklandDocument>Nested tables are not supported inside table cells.
- 错误类型:
XmlWikiConversionError - 问题原因:在
<td>或<th>内部直接放入了<table>,或者在单元格内的<annotation><content>中间接嵌套了<table>。
错误写法:
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<table header="none" widths="300">
<tr>
<td>
<table header="none" widths="150">
<tr><td>禁止嵌套</td></tr>
</table>
</td>
</tr>
</table>
</description>
</sklandDocument>修正写法:把内层表格改为列表、分段文本,或拆分为单元格外的独立表格。
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<table header="none" widths="300">
<tr>
<td>
<ul>
<li>改用列表表达二级条目</li>
</ul>
</td>
</tr>
</table>
</description>
</sklandDocument>表头模式非法与单元格冲突
包含两条消息:
-
Unsupported table header mode '<headerMode>'.(header不是none、row、col或both) -
Table header mode '<headerMode>' conflicts with cell at row <r>, column <c>.(该行列位置的<th>/<td>与当前header模式冲突) -
错误类型:
XmlWikiConversionError -
问题原因:
header="row"要求第 1 行全是<th>、其余行全是<td>;header="col"要求第 1 列全是<th>;header="both"要求第 1 行与第 1 列全是<th>;header="none"(或省略)要求全是<td>。
错误写法:
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<table header="row" widths="200,200">
<tr>
<td>应为 th</td>
<th>正确</th>
</tr>
</table>
</description>
</sklandDocument>修正写法:使表头行与 header="row" 完全对齐。
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<table header="row" widths="200,200">
<tr>
<th>第一列</th>
<th>第二列</th>
</tr>
</table>
</description>
</sklandDocument>表格行结构错误(缺行、行宽属性、非法文本与非法子元素)
包含五条消息:
-
Complex tables must contain at least one <tr>. -
Row-level width is not supported; use the table widths attribute instead.(在<tr>上写了width属性) -
Unexpected text directly inside a table row./Unexpected trailing text inside a table row. -
Unsupported tag <tag> inside <tr>.(例如在<tr>中直接写了<thead>或<span>) -
Complex tables must contain at least one column./Complex tables must contain at least one row and one column. -
错误类型:
XmlWikiConversionError -
问题原因:复杂表格没有
<tr>或没有有效单元格列;在<tr>上写了不支持的width属性;或在<tr>内直接放置了<th>/<td>之外的文本或元素。
错误写法:
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<table header="none" widths="200">
<tr width="200">
<td>单元格</td>
</tr>
</table>
</description>
</sklandDocument>修正写法:删除 <tr> 上的 width 属性,统一通过 <table> 的 widths 控制列宽。
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<table header="none" widths="200">
<tr>
<td>单元格</td>
</tr>
</table>
</description>
</sklandDocument>列宽推导失败、列宽数量不匹配与非正数值
包含六条消息:
-
Complex tables require a chapter size to derive default widths.(在<description>等非章节上下文中省略了widths) -
Unsupported chapter size '<chapterSize>' for default table widths.(在<chapter>中省略了widths,但size不是large、middle或small) -
Table widths count <n> does not match logical column count <m>. -
Complex table column widths length <n> does not match column count <m>. -
Table width '<part>' for column <n> is not numeric. -
Table column <n> width <w> must be a positive number./Complex table column <n> width <w> must be a positive number. -
错误类型:
XmlWikiConversionError -
问题原因:未满足默认列宽推导条件却省略了
widths,或者显式widths中的项数与表格逻辑列数不等,或包含非数字、0 或负数。
错误写法:
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<table header="none">
<tr>
<td>缺少 widths</td>
<td>第二列</td>
</tr>
</table>
</description>
</sklandDocument>修正写法:在 <description> 中显式写出与列数相等的正数 widths。
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<table header="none" widths="200,200">
<tr>
<td>第一列</td>
<td>第二列</td>
</tr>
</table>
</description>
</sklandDocument>网格几何错误(坐标、跨度越界与缺口)
包含八条消息:
-
Expected integer for <location>./Expected positive integer for <location>.(rowspan、colspan、col不是正整数) -
Complex table cell positions must be non-negative. -
Complex table cell spans must be positive integers. -
Complex table cell row span exceeds the table bounds. -
Complex table cell column span exceeds the table bounds. -
Complex table contains uncovered grid positions. -
错误类型:
XmlWikiConversionError -
问题原因:单元格的
rowspan/colspan/col不是正整数、跨行跨列超出了表格总行数或总列数,或者某行少写了单元格导致矩形网格中存在未被任何单元格覆盖的空洞。
错误写法:
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<table header="none" widths="200,200">
<tr>
<td>第一行第一列</td>
<td>第一行第二列</td>
</tr>
<tr>
<td>第二行缺少第二列</td>
</tr>
</table>
</description>
</sklandDocument>修正写法:补全第二行的第二个单元格,或为第一格设置 colspan="2" 铺满整行。
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<table header="none" widths="200,200">
<tr>
<td>第一行第一列</td>
<td>第一行第二列</td>
</tr>
<tr>
<td colspan="2">跨两列铺满网格</td>
</tr>
</table>
</description>
</sklandDocument>JSON 表格单元格标识错误
包含两条仅在 JSON 解析阶段触发的消息:
-
Invalid table cell id '<cellKey>'.:JSON 中cellMap的键名格式不是<rowId>_<columnId>(缺少下划线分隔符)。 -
Unknown table cell position '<cellKey>'.:JSON 中cellMap的<rowId>或<columnId>不存在于表格的rowIds/columnIds数组中。 -
错误类型:
XmlWikiConversionError -
修复方式:核对上游 Wiki JSON 的
table.rowIds、table.columnIds与table.cellMap键名是否一致。
另见
<table>复杂表格:查阅属性说明与网格规则- 标题、段落、引用与列表:查阅
<ul>/<ol>/<li>规范 - 编写表格条目:通过可运行示例演练表格构建与排错