【发布时间】:2016-02-26 03:05:49
【问题描述】:
好的,所以我在一个类中使用 DTD,并且基于两个验证器,这个特定问题存在于:
21: 63 Element type "a" must be declared.
这是 XML 中与此错误相关的行。
<etymology><a href="https://en.wikipedia.org/wiki/John_Adams">John Adams</a> (1735-1826), 2nd <a href="https://en.wikipedia.org/wiki/President_of_the_United_States">U.S. President</a></etymology>
这是我的 DTD 声明:
<!ELEMENT etymology (#PCDATA)>
由于 'a href' 不是完全必需的,或者甚至不总是以 XML 文件中每个传递的词源元素开头,我该如何正确声明它们?
我在 XML 文件的底部也有同样的情况,其中脚注元素中包含 href,我想知道它们是否也是如此。
<footnote id="g">Quillehuyte County was split from Jefferson and Clallam counties in 1868 and returned to those counties a year later.</footnote>
__
<!ELEMENT footnote (#PCDATA)>
<!ATTLIST footnote id CDATA #REQUIRED>
【问题讨论】:
-
是的,这几乎是词源和脚注元素中的 HTML 链接,我尝试过 和 并没有工作。