The main building blocks of both XML and HTML documents are Elements.
Types of Elements
There are three primary types of elements:
simple elements
These are elements that contain text or
"parsed character data" (represented as #PCDATA in your DTD).
In XHTML, the <b> tag is an example of a simple element.
compound elements
These elements contain other elements,
and sometimes PCDATA and other elements.
In XHTML, the <html> tag is an example of a compound element.
standalone elements
These elements are often called "singleton" tags.
They do not contain any PCDATA or other elements.
In XHTML, <br /> is an example of a standalone element.
Declaring an Element
With an element declaration XML elements are declared in the DTD.
An element declaration has the following syntax:
<!ELEMENT element-name category>
or
<!ELEMENT element-name (element-content)>
Empty Elements
Empty elements are declared with the category keyword EMPTY:
<!ELEMENT element-name EMPTY>
example:
<!ELEMENT br EMPTY>
XML example:
<br />
Elements with only character data
Elements with only character data are declared with #PCDATA inside parentheses:
<!ELEMENT element-name (#PCDATA)>
example:
<!ELEMENT from (#PCDATA)>
Elements with any contents
Elements declared with the category keyword ANY,
can contain any combination of parsable data:
<!ELEMENT element-name ANY>
example:
<!ELEMENT note ANY>
Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
Keywords:xml document, xml elements attribute, xml declaration, xml schema