【问题标题】:How can I show code inside of a task in DITA如何在 DITA 的任务中显示代码
【发布时间】:2016-06-01 12:32:39
【问题描述】:

以下 xml sn-p 使用 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 都不包含编程域模块,因此“learningContent”中的任何地方都不允许使用代码块。因此,当 Oxygen 报告验证错误时,它只是遵循规范。因此,例如,如果您查看 DITA 任务的 shell DTD:“DITA-OT\dtd\technicalContent\dtd\task.dtd”它在编程域(包含代码块或 codeph 等元素)内部引用,但学习 shell DTD “DITA-OT2.x\plugins\org.oasis-open.dita.v1_3\dtd\learning\dtd\learningContent.dtd”没有。
  • 好吧,你可以把它作为答案:)

标签: xml dita


【解决方案1】:

似乎 DITA 1.2 和 DITA 1.3 学习域 DTD 都不包含编程域模块,因此“学习内容”中的任何地方都不允许使用代码块。因此,当 Oxygen 报告验证错误时,它只是遵循规范。因此,例如,如果您查看 DITA 任务的 shell DTD:“DITA-OT\dtd\technicalContent\dtd\task.dtd”它在编程域(包含代码块或 codeph 等元素)内部引用,但学习 shell DTD “DITA-OT2.x\plugins\org.oasis-open.dita.v1_3\dtd\learning\dtd\learningContent.dt‌​d”没有。 因此,您可能需要学习和培训 dtd 专业化,这也增加了 programmind 领域。

【讨论】:

    【解决方案2】:

    根据规范,这应该是正确的。您没有提及您使用的是哪个版本的 oXygen。您可以尝试将代码块包装在 P 元素中,但我感觉错误是由嵌入到 learningContent 主题中的任务引起的。可能是那套专业化不包括这种方式的代码块。

    【讨论】:

    • 据我了解是的,应该是正确的。我正在使用最新的氧气版本编辑器。我尝试将其包含在 p 或其他元素中,例如 div。奇怪的是,在具有其 doctype 的单独文件中的任务不会产生此错误...
    【解决方案3】:

    这个例子也不适用于 XMetal 11(也在 Oxygen 17.0 中测试),因为它不遵循 DTD(正如 Radu Coravu 所说)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-23
      • 2018-09-30
      • 2021-06-27
      • 1970-01-01
      • 2012-04-16
      相关资源
      最近更新 更多