DTD 定义具有相同孩子的两个孩子

发布于 2025-01-08 15:41:47 字数 393 浏览 4 评论 0原文

我在 dtd 中定义了三个具有相同子元素名称的元素。正确的语法是什么:

  1. 对于具有相同定义的所有子
  2. 元素,具有不同的子元素定义

示例想法:这有效吗?

<!ELEMENT one ( childone?, childtwo? ) >
<!ELEMENT two ( childone?, childtwo? ) >
<!ELEMENT three ( childone?, childtwo? ) >
    <!ELEMENT childone ( #PCDATA ) >
    <!ELEMENT childtwo ( #PCDATA ) >

我感谢你的帮助!多谢!

I got three elements defined in a dtd which have the same child element names. What is the correct syntax for:

  1. for all children having the same definition
  2. elements having different children definitions

Example idea: is this valid?

<!ELEMENT one ( childone?, childtwo? ) >
<!ELEMENT two ( childone?, childtwo? ) >
<!ELEMENT three ( childone?, childtwo? ) >
    <!ELEMENT childone ( #PCDATA ) >
    <!ELEMENT childtwo ( #PCDATA ) >

I appreciate your help! Thanks a lot!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

巨坚强 2025-01-15 15:41:47

是的,您的示例想法对于您的第一个场景是有效的(对于具有相同定义的所有孩子)。

您的第二种情况(元素具有不同的子定义)是不可能的。每个元素只能有一个声明。您必须声明具有唯一名称的新元素。

Yes, your example idea is valid for your first scenario (for all children having the same definition).

Your second scenario (elements having different children definitions) isn't possible. You're only allowed to have one declaration per element. You would have to declare new elements with unique names.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文