Home >> FAQs/Tutorials >> XHTML Tutorials and Tips >> Index

XHTML Tutorials - Introduction To Element Content Syntax

By: FYICenter.com

Part:   1  2  3   4 

(Continued from previous part...)

What Is PCDATA?

PCDATA stands for Parsed Character DATA. Here are some basic rules about PCDATA:

  • PCDATA is a string of characters and XHTML entities.
  • XHTML entities are escape sequences used to refer to special characters that are not so easy to enter them in a text document. For example, "©" is XHTML entity referring to the copyright character: "©".
  • 3 special characters: "<", ">", and "&" can not be used directly in PCDATA. They must be replaced by the corresponding XHTML entities: "&lt;", "&gt;", and "&amp;".
  • If "<" is used in PCDATA, it will be parsed as the beginning of a XHTML tag.
  • If "&" is used in PCDATA, it will be parsed as the beginning of a XHTML entity.

Below you will see some good examples of PCDATA:

  c FYICENTER
  &copy; FYICENTER
  &copy; &#70;&#89;&#73;&#67;&#69;&#78;&#84;&#69;&#82;

What Is an XHTML Entity?

An XHTML entity is escape sequence used to represent a special character that is hard to enter via a normal keyboard. For example, you can not find a key on your keyboard to enter the copyright character, "©" directly. You need to use the XHTML entity "&copy;" to represent the copyright character in your XTHML document.

Valid XHTML entities are defined in the following 3 files:

What Is CDATA?

CDATA stands for Character DATA, which is used to define a section of data that should not go through the XHTML entity translation (parsing) process. In other words, 3 special characters: "<", ">", and "&" can be directly used in CDATA. They will not be "parsed".

CDATA must starts with "<![CDATA[" and ends with "]]>". Here are some good examples:

  <![CDATA[Adam & Eve]]>
  <![CDATA[
    Sample XHTML code:
    <p>1</p>
    <p>1 1</p>
    <p>1 2 1</p>
    <p>1 3 3 1</p>
    <p>1 4 6 4 1</p>
  ]]>

What Is a Sub-element?

A sub-element is an XHTML element that is included inside the content of another XHTML element. The inner element is called the sub-element or child element. The outer element is called the parent element. Together they are called nested elements.

Note that which element is allowed to be included inside another element is defined by the XHTML specification. For example, element "p" is allowed inside "body", but it is not allowed inside "head".

Can Two Elements Partially Overlap Each Other?

No, two elements can not partially overlap each other. One element must be completely enclosed inside the other element. See the following two examples:

  <!-- Valid: "em" is enclosed inside "strong" --> 
  <p>There was once upon <strong>a time a <em>peasant-
    woman</em> who had a daughter</strong> and a step-
    daughter.</p>
 
  <!-- Invalid: "em" is partially overlapped 
    with "strong" -->
  <p>There was once upon <strong>a time a <em>peasant-
    woman</strong> who had a daughter</em> and a step-
    daughter.</p>	

(Continued on next part...)

Part:   1  2  3   4 


Selected Developer Jobs:

More...