不确定的内容模型错误 DTD

non-deterministic content model error DTD

鉴于:

<!ELEMENT diagnostic-tracks (hookup*, (%step;)*, ((diagnostic-track-automated, diagnostic-track-manual) | diagnostic-track-automated | diagnostic-track-manual), evaluate*, disconnect*)>

<!ELEMENT diagnostic-track-automated (((%step;) | diagnostic_group)*, diagnostic_group, evaluate*)>

<!ENTITY % step "((%figtab;) | step1 | step1-alt)">
<!ENTITY % figtab "figure | figure-alt | table | table-alt | lubetab">

我收到不确定的内容模型错误,诊断跟踪自动化和 diagnostic_group 可以同时匹配两个或多个标记。

我改为:

<!ELEMENT diagnostic-tracks (hookup*, (%step;)*, diagnostic-track-automated?, diagnostic-track-manual?, evaluate*, disconnect*)>

<!ELEMENT diagnostic-track-automated (((%step;) | diagnostic_group+)*, evaluate*)>

消除了错误消息,但我认为我的更改,尤其是 diagnostic-track-automated 的更改是正确的。

感谢任何改进建议。

我认为你为 diagnostic-tracks 想出的似乎是你试图用原始的非确定性模型完成的:

zero or more hookup elements followed by
zero or more elements from %step; followed by
zero or one diagnostic-track-automated element followed by
zero or one diagnostic-track-manual element followed by
zero or more disconnect elements

但是我认为 diagnostic-track-automated 的修复不是您最初想要的。

您现在的建议是:

zero or more elements from %step; or diagnostic_group followed by
zero or more evaluate elements

我想你的意思是:

zero or more elements from %step; followed by
one or more diagnostic_group elements followed by
zero or more evaluate elements

这将是:

<!ELEMENT diagnostic-track-automated ((%step;)*, diagnostic_group+, evaluate*)>

这是一个 full/testable 示例...

DTD (so.dtd)

<!ENTITY % figtab "figure | figure-alt | table | table-alt | lubetab">
<!ENTITY % step "%figtab; | step1 | step1-alt">

<!ELEMENT diagnostic-tracks (hookup*, (%step;)*, diagnostic-track-automated?, diagnostic-track-manual?, evaluate*, disconnect*)>

<!ELEMENT diagnostic-track-automated ((%step;)*, diagnostic_group+, evaluate*)>

<!ELEMENT table EMPTY>
<!ELEMENT table-alt EMPTY>
<!ELEMENT diagnostic_group EMPTY>
<!ELEMENT step1-alt EMPTY>
<!ELEMENT evaluate EMPTY>
<!ELEMENT figure EMPTY>
<!ELEMENT figure-alt EMPTY>
<!ELEMENT lubetab EMPTY>
<!ELEMENT step1 EMPTY>
<!ELEMENT diagnostic-track-manual EMPTY>
<!ELEMENT disconnect EMPTY>
<!ELEMENT hookup EMPTY>

XML

<!DOCTYPE diagnostic-tracks SYSTEM "so.dtd">
<diagnostic-tracks>
    <diagnostic-track-automated>
        <diagnostic_group/>
    </diagnostic-track-automated>
    <diagnostic-track-manual/>
</diagnostic-tracks>