Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 200
0 Users 3 Guests Online

XML

EXtensible
Markup
Language

With XML, your data is stored outside your HTML.

With XML, data can be exchanged between incompatible systems.

With XML, financial information can be exchanged over the Internet.

With XML, plain text files can be used to share data.

With XML, plain text files can be used to store data.

With XML, your data is available to more users.

XML is the mother of WAP and WML.

Example XML Document
Code

<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Daniel</to>
<from>Josh</from>
<heading>Whats Up?</heading>
<body>This is a GREAT website!</body>
</note>


The first line in the document - the XML declaration - defines the XML version and the character encoding used in the document. In this case the document conforms to the 1.0 specification of XML and uses the ISO-8859-1 (Latin-1/West European) character set.

The next line describes the root element of the document (like it was saying: "this document is a note"):

Code
<note>


The next 4 lines describe 4 child elements of the root (to, from, heading, and body):

Code

<to>Daniel</to>
<from>Josh</from>
<heading>Whats Up?</heading>
<body>This is a GREAT website!</body>


And as you do for any other code, you close it,
Code
</note>


<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>

This is an HTML form of XML
Code

<p>This is a paragraph
<p>This is another paragraph


This is a legal action of XML
Code
<p>This is a paragraph</p>
<p>This is another paragraph</p>


XML IS case sensitive

Code
<Message>NOT CORRECT!!</message>
<message>Correct!!</message>


You must nest properly!
Code

<b><i>No</b></i>
<b><i>Yes</i></b>


All XML documents must contain a single tag pair to define a root element.
Code
<root>
<child>
<subchild>.....</subchild>
</child>
</root>


With XML, it is illegal to omit quotation marks around attribute values.
Incorrect
Code
<?xml version="1.0" encoding="ISO-8859-1"?>
<note date=08/27/06>
<to>Daniel</to>
<from>Josh</from>
</note>


Correct
Code
<?xml version="1.0" encoding="ISO-8859-1"?>
<note date="08/27/06">
<to>Daniel</to>
<from>Josh</from>
</note>
Joshua
Author:
Views:
1891
Rating:
There are currently no comments for this tutorial.