2

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?

4

1 回答 1

2

不,但如果你使用 type ANY,它仍然可以是空的。

例子:

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

-

<!DOCTYPE name [
<!ELEMENT name ANY>
<!ELEMENT foo (#PCDATA)>
]>
<name>
    <foo/>
</name>
于 2012-10-04T22:14:48.797 回答