Declaring Zero or One Occurrences of the Same Element
Return to the Java Programming Corner.
Examples
<!ELEMENT element-name (child-name?)> example <!ELEMENT note (message?)> example <!ELEMENT note (to+,from,header,message*,#PCDATA)>
- The ? sign in the example above declares that the child element message can occur zero or one times inside the note element.
- The + sign declares at least one "to" child element.
- With no sign declaration, exactly one "from" child element.
- With no sign declaration, exactly one "header" child element.
- The * sign declares zero or more "message" child elements,
- The #PCDATA declaration, indicates some other parsed character data.