Nov 11, 2011

Components of an XML Document

Components of an XML Document
In XML document comprises storage units containing parsed or unparsed data.
Parsed character data (PCDATA) is textual information comprising:
The markup that describes the data it contains. Markup includes:
Elements to describe the data it contains such as the root element (employees) and its child elements (employee, name)
Attributes, which are name and value pairs (id="100") included in the start tag of an element
The entities (') representing any character data substituted in place of their appearance
Character data described by the markup components, for example:
The value 100 assigned to the id attribute
The data Rachael O’Leary described by the element
The ' entity, which represents the apostrophe (') character
Note: The element tree in an XML document defines its layout and logical structure.
The unparsed data embedded in CDATA sections can be used in an XML document to contain textual data or encoded binary data such as graphic and sound files. A CDATA section starts with characters. The information contained inside the CDATA section is not parsed by an XML Parser and is taken as entered.

XML Elements :
A start tag (for example, ) includes:
The “<” character
A case-sensitive tag name (employee), without leading spaces
The “>” character
An end tag (for example
) includes:
The “<” character
A case-sensitive tag name that must be identical to the start tag name, but prefixed with a slash. Leading spaces are not permitted.
The “>” character
Data content: Can also contain elements such as in the slide example
In summary, an XML element includes a start tag, an end tag, and everything in between.
Empty elements have no content between the start and end tags. In this case, a shortened form can be used where the start tag name is followed by a slash (for example, ).
Tag names are a descriptive term for an XML element and its content (for example, employee). The tag name is known as the element type name.

XML Attributes:
Attributes are simple name-value pairs that are associated with a particular element. XML attributes must be specified after the start tag of an element or after the tag name of an empty element.
Example:
Attribute names are case-sensitive and follow the naming rules that apply to element names. In general, spaces are not used, but are allowed, on either side of the equal sign. Attribute names should be unique within the start tag.
The attribute values must be within matching quotation marks, either single or double. The example in the slide shows the employee id attribute value enclosed within double quotation marks and the name attribute value within single quotation marks. In the latter case, the &apos; entity must be used to include the apostrophe (single quotation mark) character in the name value.
Attributes provide additional information about the XML document’s content or other XML elements. Attributes can be used for the following purposes:
Describing how the XML document data is encoded or represented
Indicating where the links or external resources are located
Identifying and calling external processes such as applets and servlets
Specifying an element instance in the document for facilitating a rapid search
Note: Attributes always have a value. For example, name="" has an empty string value.

No comments:

OraApps Search

Custom Search

Search This Blog