Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Group info
Members: 21
Language: English
Group categories:
Computers > Databases
Computers > Programming
Computers
More group info »
Recent pages and files
php-and-xml-part-1    

In this tutorial we're going to start looking at XML, with a view toworking with XML using PHP. In this first part of this series we aregoing to go through the theory of XML, looking at creating an XMLdocument and the structure of an XML document.

We will then create an example XML document to put the theory into practice.
What is XML?

XMLstands for eXtensible Markup Language and is termed a meta-language,which means that it's a language used to create other markup languages.XML provides a structure and a set of rules for organizing information,which can be used to create other markup languages. XML isn't justdesigned for the web; it can be used to represent any type ofinformation, on any type of computer or device and is ideal to exchangeinformation between different systems.

In an XML document, thetags are used to describe the data that is held in the XML document.Unlike HTML, XML allows you to define your own tags, so you canessentially create your own markup language, although sticking to therules of XML, which define the document's structure.
HTML and XML

HTMLwas originally designed to as a means of sharing ideas betweenscientific researchers. Web pages were all text, without graphics orformatting information and the focus of the technology was on thecontent of the information, rather than the way the information wasdisplayed. Over the years, HTML has been expanded so that it containsmore tags, which allow you to format information in different ways,however this has created problems.

Web browsers have beencreated to allow maximum tolerance for HTML code, so if the HTML is notstrictly correct it is usually still displayed as the user intended. Asan example, consider the HTML code shown below:


This is an example of incorrect HTML that is displayed correctly





When this HTML page is viewed in Internet Explorer, you will see the following:



As you can see, the page is displayed as was intended, even though the HTML had a large number of mistakes, for example:

* No tags
* No tags
* No closing
tag
* No closing tag

However,IE compensated and essentially corrected these mistakes for us. Theproblem with this is that the web browser becomes much larger in termsof size, as it requires much more code to enable it to interpret theinformation correctly, and correct any mistakes in the HTML code. Thiscauses problems also for the newer devices coming out, such as PDA'sand Mobile Phones as, due to their memory limitations, they can'tafford to have large bloated web browsers built in.

Also different browsers may display the incorrect code in different ways, so the page may not be displayed as intended!

Anotherproblem with HTML is that, because the formatting information is mixedin with the content, it can be difficult for different systems toparse, or understand, the data. Even for a human looking at a page ofHTML it can be difficult to understand, and says nothing about theactual meaning of the data held in the HTML document.

XML helpsin this situation because it has strict rules governing the syntax ofthe document so that browsers do not require any extra tolerance codebuilt in, allowing for smaller and faster browsers. It also splits theformatting information away from the data, and allows you to createyour own tags, which describe the data itself, and allows the data tobe easily parsed by a range of different software and systems.

FOR FULL ARTICLE ... CLICK HERE!!!

?

Version: 
Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google