DTD element empty and any

百般思念 提交于 2019-12-24 01:16:17

问题


In a dtd, can an element be defined as

<!ELEMENT name (ANY|EMPTY)>

meaning that an name can either be like <name/> or it can contain any elements that does break xml rules?


回答1:


No, but if you use the type ANY, it can still be empty.

Examples:

<!DOCTYPE name [
<!ELEMENT name ANY>
]>
<name/>

-

<!DOCTYPE name [
<!ELEMENT name ANY>
<!ELEMENT foo (#PCDATA)>
]>
<name>
    <foo/>
</name>


来源:https://stackoverflow.com/questions/12736648/dtd-element-empty-and-any

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!