简体   繁体   中英

What is the difference between html and xml?

Blogger blogs use XML, and Tumblr blogs use HTML, but they both do the same thing. What is the difference between XML and HTML and what are the pros and cons of using them?

HTML is a markup language for describing hypertext ("with links") documents.

XML is a generic markup language designed for using as a base for building custom markup languages.

They are different tools for different jobs.


When you write a template for either Blogger or Tumblr, you are using a template language. Blogger's template language happens to be built in XML. The template language is combined with your data to generate the HTML documents that are sent to the browser.

XML was developed to describe data and to focalize on what the data represent.

HTML was developed to display data about to focalize on the way that data looks.

HTML is about displaying data, XML is about describing information.

Reference

XML was developed to describe data and to focalize on what the data represents.

Whereas HTML describes the structure of Web pages using markup.

In other words, HTML is used to display data, XML is used to store and transport data.

In an ideal world, HTML would be just one of many XML vocabularies. The only reason it isn't is history: (a) it was wild on the web before XML was formulated, and (b) it developed a culture where you could write any old garbage and the browsers would try and make sense of it, whereas XML insisted that you stick to the rules.

The W3C spent about ten years trying to make this vision happen, through the medium of XHTML, but in the end the browser vendors decided to go their own way.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM