Thursday, 1 September 2011

XML

XML was created by W3C to overcome the limitations of HTML.

HTML was designed with Humans in mind. As humans, you and I have the intelligence to understand the meaning and intent of most documents.

A machine, unfortunately, can't do that. While the tags in the document tell a browser how to display this information, the tags don't tell the browser what the information is.

A tag is the text between the left angle bracket (<) and the right angle bracket (>). There are starting tags (such as <name>) and ending tags (such as </name>)

An element is the starting tag, the ending tag, and everything in between. e.g.the <name> element can contain three child elements:
<title>, <first-name>, and <last-name>.


An attribute is a name-value pair inside the starting tag of an element.

XML creates document with self-describing data.
XML simplifies data interchange.
XML enables smart code.
XML enables smart searches.


Parser is a piece of code that attempts to read a document and interpret its contents.

Invalid Documents: don't follow the XML syntax rules and the rules defined in DTD/Schema.

Valid Documents: follow both the XML syntax rules and the rules defined in DTD/Schema.

Well-formed Documents: follow the XML syntax rules but don't have a DTD/Schema.

An XML document must be contained in a single element. That single element is called the root element, and it contains all the text and any other elements in document.

XML elements can't overlap.
You can't leave out any end tags.
XML elements are case sensitive.

XML Attributes must have values, those values must be enclosed within quotation marks.
If the value of the attribute contains a single or double quote:
a) you can use like (name="Preetesh's car")
b) Use Entity like &quot, &apos.


Most XML documents start with an XML declaration that provides basic information about the document to the parser.

The declaration can contain up to three name-value pairs.
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>ISO-8859-1 includes all char-set used by most Western European languages.
default encoding is "UTF-8".
default reference is 'standalone="no" '.
standalone="yes" means this XML doc can be processed without reading any other files.

A comment begins with <!-- and ends with -->.

No comments:

Post a Comment