以下 xml 代码段在使用 Oxygen XML 编辑器的 Xerces 引擎中产生以下错误:
意外元素"代码块"。父元素类型的内容 必须匹配 "(dl|div|lcInteractionBase2|lcTrueFalse2|lcSingleSelect2|lcMultipleSelect2|lcSequencing2|lcMatching2|lcHotspot2|lcOpenQuestion2|fig|imagemap|lcInteractionBase|lcTrueFalse|lcSingleSelect|lcMultipleSelect|lcSequencing|lcMatching|lcHotspot|lcOpenQuestion|image|lines|lq|note|lcInstructornote|lcInstructornote2|object|ol|p|pre|simpletable|sl|table|ul|boolean|cite|keyword|ph|b|i|line-through|overline|sup|sub|tt|u|q|term|text|tm|xref|state|data|sort-as|data-about|foreign|unknown|draft-comment|fn|indextermref|indexterm|required-cleanup)"。
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE learningContent PUBLIC "-//OASIS//DTD DITA Learning Content//EN" "learningContent.dtd">
<learningContent id="oc4j_learning_task1">
<title>Task 1</title>
<shortdesc></shortdesc>
<learningContentbody></learningContentbody>
<task id="oc4j_task1">
<title>Task 1</title>
<shortdesc/>
<taskbody>
<context>
<p><b>Requirements</b></p>
</context>
<steps>
<step>
<cmd>Login with sftp in the production server</cmd>
</step>
<step>
<cmd>Download the whole directory OC4J10 in your local directory</cmd>
</step>
<step>
<cmd>Make sure the system is using the same JDK (currently 1.6.0_45) from Oracle</cmd>
</step>
<step>
<cmd>Change the following files in /OC4J10/j2ee/home/config</cmd>
<substeps id="substeps_vty_xh4_dw">
<substep>
<cmd>application.xml</cmd>
<info>the file should point to the WAR (or expanded) files in your local
machine where the application modules are located as in following
example:
<codeblock>foo
</codeblock>
</info>
</substep>
</substeps>
</step>
</steps>
</taskbody>
</task>
</learningContent>
我试图放置一个像div 这样的父元素(正如错误所建议的那样?),但它也不起作用。
似乎 DITA 1.2 和 DITA 1.3 学习域 DTD 都不包含编程域模块,因此代码块不允许在"学习内容"中的任何位置使用。因此,Oxygen在报告验证错误时只是遵循规范。例如,如果你查看DITA任务的shell DTD:"DITA-OT\dtd\technicalContent\dtd\task.dtd",它会在编程域内引用(其中包含代码块或codeph等元素),但学习shellDTD"DITA-OT2.x\plugins\org.oasis-open.dita.v1_3\dtd\learning\dtd\learningContent.dt d"则没有。因此,您可能需要学习和培训dtd专业化,这也增加了程序思维域。
根据规范,这应该是正确的。你没有提到你正在使用哪个版本的oXygen。您可以尝试将代码块包装在 P 元素中,但我感觉错误是由嵌入在 learningContent 主题中的任务引起的。可能是这组专用化不包括代码块。
这个例子在XMetal 11上也不起作用(也在Oxygen 17.0中测试过),因为它不遵循DTD(正如Radu Coravu所说)。