YouTip LogoYouTip

Dtd Elements

* * * In a DTD, elements are declared through element declarations. * * * ## Declaring an Element In a DTD, XML elements are declared using element declarations. The syntax for element declarations is as follows: or * * * ## Empty Elements Empty elements are declared using the keyword EMPTY: Example: XML example:
* * * ## Elements with Only PCDATA Elements that contain only PCDATA are declared using #PCDATA enclosed in parentheses: Example: * * * ## Elements with Any Content Elements declared using the keyword ANY can contain any combination of parsable data: Example: * * * ## Elements with Child Elements (Sequence) Elements with one or more child elements are declared by listing the child element names within parentheses: or Example: When child elements are declared in a sequence separated by commas, these child elements must appear in the same order in the document. In a complete declaration, child elements must also be declared, and child elements can themselves have child elements. The full declaration for the "note" element is: * * * ## Declaring Elements That Appear Exactly Once Example: The above example declares that the child element message must appear exactly once and only once within the "note" element. * * * ## Declaring Elements That Appear at Least Once Example: The plus sign (+) in the above example declares that the child element message must appear at least once within the "note" element. * * * ## Declaring Elements That Appear Zero or More Times Example: The asterisk (*) in the above example declares that the child element message can appear zero or more times within the "note" element. * * * ## Declaring Elements That Appear Zero or One Time Example: The question mark (?) in the above example declares that the child element message can appear zero or one time within the "note" element. * * * ## Declaring "Not.../Or..." Type Content Example: The above example declares that the "note" element must contain the "to" element, the "from" element, the "header" element, and either the "message" element or the "body" element. * * * ## Declaring Mixed Content Example: The above example declares that the "note" element can contain zero or more occurrences of PCDATA, "to", "from", "header", or "message".
← Dtd AttributesDtd Building β†’