Welcome!

Hello, I am glad you have decided to read my blog! I will be hopefully updating and adding new posts often. Feel free to comment and follow me.

Thanks Again,

Jon

Sunday, January 29, 2012

XML vs. HTML


Introduction
XML, or EXtensible Markup Language is a markup language much like HTML (HyperText Markup Language), with a few key differences. One main difference in the two languages is XML carries, transports and stores data that focuses on what data is. HTML mainly displays information and focuses on how data looks on a page. 


XML
XML is the carrier service of data and information for a page. XML also creates structure to the page. It creates the structure but essentially does not DO anything. Here is an example of an XML document found from w3schools:

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

This note is very descriptive, but essentially does nothing other than storing and transporting information. 

One other thing that is unique from XML is that the tags are not defined by any standard like HTML, but these tags are created by the author. 

Another situation you could use XML is also at http://www.w3schools.com/xml/simple.xml. This document displays a ton of information about a restaurant breakfast menu. It does not contain any information on how to display it, so it just shows the file as it is. XML is used for storing information rather than displaying it.  

HTML
On the other hand, HTML is the TV display of the two, it tells how the document should look on a page and focuses less on the information it holds, although it does have information on the page.

HTML or HyperText Markup Language files tells web browsers like Internet Explorer, Mozilla Firefox and Google Chrome how to display a HTML document on the page.

HTML language does this by using a standard set of tags. An HTML tag is a simple keyword surrounded by brackets (<)(>) that have meanings.

For example if you wanted to display an image on a HTML page you would use the <img> tag followed by the location of the image.
 
Usually tags come in pairs, these are called opening and closing tags. They define that the tag is beginning and then ending. 

One great example comes from http://www.w3schools.com/html/html_intro.asp

<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body>
</html>

The tag <html> describes the page.
The tag <body> displays the visible page content.
the text displayed between the <h1> and </h1> is displayed as a heading and the same for <p> and </p> as this shows a paragraph.

In this example, <h1> would be the opening tag and </h1> would be the closing tag. This applies for all of the tags in this document.

In this second example from, http://www.w3schools.com/html/tryit.asp?filename=tryhtml_newfont the HTML document is formatting the text font, size and color.

Here is the html text below:
<html>
<body>
<h1 style="font-family:verdana;">A heading</h1>
<p style="font-family:arial;color:red;font-size:20px;">A paragraph.</p>
</body>
</html>
 This is what the page would look like:

A heading

A paragraph.


HTML is very powerful at displaying information onto web pages. This is just the basics of HTML. It can go into great detail to how specific you want your page to look. 


Conclusion
As you can see, HTML and XML are both very powerful tools and can be used in many ways. XML and HTML are very different tools, but both are very useful. Both of these tools are very powerful in the business world in that there is tons of information that businesses need to keep up with and the internet displays many businesses on the web, XML and HTML are just some ways businesses do business in today's world.







No comments:

Post a Comment