行内元素与注释错误
This page is not available in your language yet.
行内元素负责表达文本样式、颜色、条目引用、表情、换行与弹出注释。当颜色或引用类型超出受校验集合、空元素包含正文内容,或出现注释嵌套时,转换器会抛出 XmlWikiConversionError。
类别总览
| 错误消息模式 | 错误类型 | 触发阶段 |
|---|---|---|
<color> must include a value attribute. | XmlWikiConversionError | XML 解析 |
Unsupported XML color '<colorValue>'. | XmlWikiConversionError | XML 解析 / JSON 渲染 |
Unsupported JSON color '<colorName>'. | XmlWikiConversionError | JSON 解析 |
<entry> must include a type attribute. | XmlWikiConversionError | XML 解析 |
Unsupported entry type '<entryType>'. | XmlWikiConversionError | JSON 渲染 |
Unsupported entry showType '<showType>'. | XmlWikiConversionError | JSON 解析 |
Emoji must include a nonempty id. | XmlWikiConversionError | XML / JSON 解析 / 模型校验 |
<emoji> must not contain content. | XmlWikiConversionError | XML 解析 |
<emoji> only supports the id attribute. | XmlWikiConversionError | XML 解析 |
gameIcon.text must be empty. | XmlWikiConversionError | JSON 解析 |
<br> must not contain content. | XmlWikiConversionError | XML 解析 |
<annotation> must contain exactly one <title> and one <content>. | XmlWikiConversionError | XML 解析 |
Nested annotations are not supported. | XmlWikiConversionError | XML / JSON 解析 / 模型校验 |
Unsupported inline tag <tag>. | XmlWikiConversionError | XML 解析 |
Unsupported inline kind '<kind>'. | XmlWikiConversionError | JSON 解析 |
Unsupported inline type. | XmlWikiConversionError | XML / JSON 渲染 |
<color> 属性缺失与不支持的预设色值
包含三条消息:
-
<color> must include a value attribute. -
Unsupported XML color '<colorValue>'. -
Unsupported JSON color '<colorName>'. -
错误类型:
XmlWikiConversionError -
问题原因:
<color>缺少value属性,或者提供的色值不在 20 种受校验预设色值(s_1–s_4、r_1–r_6、f_orange、f_turquoise、f_green、f_sandstone、f_yellow、f_red、f_blue、f_brown、f_violet、f_blueness)之内,例如使用了 CSS 颜色名或十六进制色码。JSON 解析时若color字段不在对应 JSON 映射表中也会报错。
错误写法:
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<color value="#ff0000">非法十六进制颜色</color>
</description>
</sklandDocument>修正写法:改用合法预设色值(例如 f_red)。
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<color value="f_red">合法预设颜色</color>
</description>
</sklandDocument><entry> 类型缺失与不支持的引用类型
包含三条消息:
-
<entry> must include a type attribute.(XML 解析) -
Unsupported entry type '<entryType>'.(JSON 渲染,输入 XML 中使用了非法的type值或手工构造了非法模型) -
Unsupported entry showType '<showType>'.(JSON 解析,JSON 中entry.showType不在card-big、link-imgText、link-text中) -
错误类型:
XmlWikiConversionError -
问题原因:
<entry>缺少type,或把 JSON 侧的名称(link-imgText、link-text)误写到了 XML 中。
错误写法:
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<entry type="link-imgText" count="1" id="42"/>
</description>
</sklandDocument>修正写法:在 XML 中使用 card-big、link-img 或 link-txt。
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<entry type="link-img" count="1" id="42"/>
</description>
</sklandDocument><emoji> 属性、内容与 JSON gameIcon.text 错误
包含四条消息:
-
Emoji must include a nonempty id.(id缺失或仅含空白字符) -
<emoji> must not contain content.(<emoji>内部写了文本或子元素) -
<emoji> only supports the id attribute.(<emoji>上出现了id以外的额外属性) -
gameIcon.text must be empty.(JSON 解析时gameIcon节点的text不为空字符串) -
错误类型:
XmlWikiConversionError -
问题原因:
<emoji>必须是只含非空id属性的空元素。
错误写法:
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<emoji id="emoji_001" alt="微笑">不能写内容</emoji>
</description>
</sklandDocument>修正写法:移除多余属性与内容,改写为自闭合空元素。
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<emoji id="emoji_001"/>
</description>
</sklandDocument><br> must not contain content.
- 错误类型:
XmlWikiConversionError - 问题原因:
<br>元素内包含非空文本或子元素(即使在纯文本容器如<cell>、<audio>或普通段落内都不允许)。
错误写法:
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>第一行<br>多余文本</br>第二行</description>
</sklandDocument>修正写法:使用空元素 <br/> 或 <br></br>。
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>第一行<br/>第二行</description>
</sklandDocument><annotation> 结构错误与禁止嵌套
包含两条消息:
-
<annotation> must contain exactly one <title> and one <content>. -
Nested annotations are not supported. -
错误类型:
XmlWikiConversionError -
问题原因:
<annotation>缺少<title>或<content>、出现多个<title>/<content>、包含多余子元素,或在<title>或<content>内部(直接或间接)再次嵌套了<annotation>。
错误写法:
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<annotation>
<title>外层注释</title>
<content>
<annotation>
<title>非法内层注释</title>
<content>不可嵌套</content>
</annotation>
</content>
</annotation>
</description>
</sklandDocument>修正写法:确保每个 <annotation> 恰好有一个 <title> 和一个 <content>,并将内层说明改为普通段落或强调样式。
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<annotation>
<title>外层注释</title>
<content>使用 <b>粗体</b> 或普通段落解释次级概念。</content>
</annotation>
</description>
</sklandDocument>Unsupported inline tag <tag>.、Unsupported inline kind '<kind>'. 与 Unsupported inline type.
- 错误类型:
XmlWikiConversionError - 问题原因:在行内样式容器(如
<b>、<i>、<color>、<title>)中放入了不支持的行内元素或块级元素(例如在<b>中放<table>或<span>);JSON 解析遇到未知inline.kind;或手工构造的DocumentModel含有未定义的inlineType。
错误写法:
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<b><span>不支持 span</span></b>
</description>
</sklandDocument>修正写法:仅使用合法的行内元素组合。
<?xml version="1.0" encoding="UTF-8"?>
<sklandDocument>
<itemId>1</itemId>
<metainfo>
<name>示例</name>
<cover/>
<subTypes/>
</metainfo>
<description>
<b><color value="f_blue">合法行内组合</color></b>
</description>
</sklandDocument>另见
- 行内样式与颜色:核对全部 20 个预设色值
- 行内引用元素:查阅
<a>、<entry>与<emoji>规范 <annotation>注释:查阅<title>与<content>内容模型- 行内元素与颜色映射表:查阅 XML 与 JSON 之间的精确名称映射