How to specify unlimited children in a DTD?
I have a root tag <alphabet>
which can have an 开发者_高级运维unlimited (but optional) number of tags <a>
or <b>
or <c>
in them. How do I specify this in a DTD?
Use the *
occurrence indicator:
<!ELEMENT alphabet (a|b|c)*>
You could also use ANY
if you don't know what children alphabet
will have:
<!ELEMENT alphabet ANY>
Note that whatever elements (tags) that appear inside of alphabet
still need to be declared. See my answer here for an example.
精彩评论