Tuesday, February 7, 2012

3 XML vs. HTML

Xml stands for EXtensible Markup Language and Html stands for hypertext markup language, meaning they’re both markup languages they look and are very similar but not the same. In short, the purpose of html is to display data, Html is really only for the web, while xml sends and stores data.
Xml tags are case sensitive, must have an end tag (while some html tags don’t have an end tag and some html end tags are no longer needed when you get into html5), must be nested in order, some characters must be written differently, and attributes in tags must be in quotes unlike html. Which sucks, because that makes it easier to have one character wrong or nested incorrectly the whole thing not work and harder to find the error in the code with xml, because of newer versions of html like html4 and html5 html is more forgiving than xml. The upside is that unlike html, that has predefined tags aka you can’t use anything but those tags, xml you make up your own tags; and xml saves all the spaces you typed when html just gets rid of white space, I mean how many times have you had to figure out the code for an indent with html but with xml you can just indent like you normally would!

Examples:
Nesting…
Correct <b><i>text</i></b> ok for html and xml
Incorrect <b><i>text</b></i> not ok for xml but like will still work in html

Html tags that don’t have an end tag…
<br><img><meta> <hr> (for more examples see http://webdesign.about.com/od/htmltags/qt/html-void-elements.htm)

Some end tags are no longer needed when you get into html4 and html5 (explained here http://webdesign.about.com/od/htmltags/qt/optional-html-end-tags-when-to-include-them.htm)
Correct <p> text</p>        will work for xml and html
Incorrect <p>text               will never work in xml but you can get away with it with html

Attributes in tags must be quoted…
Correct <body color=“navy”>content</body> ok for both html and xml
Incorrect <body color=navy>content</body> again will work with html but not at all with xml

Case sensitivity…
Correct <title>the title text</title> ok for both xml and html
Incorrect <Title>the title text</title> will work in html but not xml

Odd characters like > < ^ & “”   ‘’ must be written differently…
Use &amp; for & and &quot; for “
The truth is that you’re supposed to write odd characters like this for html but html will let you get away with these. With xml you must use the code for these kinds of characters, not type it out like a word document.

For more examples and more info about xml see http://www.w3schools.com/xml/xml_syntax.asp


All RSS (really simple syndication) feeds are (a type of standard way of writing)  xml, for those of you guys that don’t know or don’t use RSS feeds, RSS is like a special bookmark instead a bookmark you would save on your browser to link to a favorite website. RSS feeds are like news feeds or rather updates feed of that website so for example: if a new webpage is added to the website the RSS feed would show that update and link you to the new page - Or link you to whatever the update might be like a new story (a lot of newspaper websites have RSS feeds) or new song all in a short drop down list with most recent update up top.

  (screen shots of the bottom right of homepages of http://www.msnbc.msn.com/     News and http://www.foxnews.com/)


(Despite flash and php) Still nothing can replace html for making websites, xml just complements html. Xml was created with the idea in mind of the conundrum of “how to we send this info from a website into our database (or other application) easily when they’re incompatible?” The answer, xml stores data in plain text format that reads as if you’re reading a word document (a more accurate description would be reading .txt file in notepad but with an .xml file extension instead) and since almost all programs can read text documents it’s much easier for other programs to translate and transfer the data into them. One of the most annoying problems with technology is that it keeps changing which means updating to the new, and updating is a pain with all the incompatible software and hardware and converting data, since xml comes out reading like text this is no problem.
Xml isn’t just data sent from a website to an application xml sends data to reading\voice machines for the disabled like a computer that reads out loud text that’s on their screen on your website.

No comments:

Post a Comment