Home  >  Article  >  Web Front-end  >  xml html xhtml html5

xml html xhtml html5

WBOY
WBOYOriginal
2016-09-15 11:15:141216browse

1, XML

What is XML?

  • XML stands for EXtensible Markup Language
  • XML is a markup language, very similar to HTML
  • XML is designed to transmit data, not display data
  • XML tags are not predefined. You need to define the labels yourself.
  • XML is designed to be self-describing.
  • XML is a recommended standard by W3C

Main differences between XML and HTML

XML is not a replacement for HTML.

XML and HTML are designed for different purposes:

XML is designed to transmit and store data, with the focus being the content of the data.

HTML is designed to display data, with the focus being on the appearance of the data.

HTML is designed to display information, while XML is designed to transmit information.

XML without any behavior

XML does nothing.

Maybe this is a little hard to understand, but XML doesn't do anything. XML is designed to structure, store and transmit information.

The following is a note from John to George, stored as XML:

<note>
<to>George</to>
<from>John</from>
<heading>Reminder</heading>
<body>Don't forget the meeting!</body>
</note>

The note above is self-descriptive. It has a title and message, and contains information about both the sender and the recipient.

However, this XML document still doesn't do anything. It's just pure information wrapped in XML tags. We need to write software or programs to transmit, receive and display this document.

XML is just plain text

XML is nothing special. It's just plain text. Any software capable of processing plain text can process XML.

However, applications that can read XML can process XML tags in a targeted manner. The functional meaning of labels depends on the characteristics of the application.

With XML you can invent your own tags

The tags in the above example are not defined in any XML standard (such as and ). These tags are invented by the creator of the document.

This is because XML does not have predefined tags.

The tags used in HTML (and therefore the structure of HTML) are predefined. HTML documents only use tags defined in the HTML standard (such as

,

, etc.).

XML allows creators to define their own tags and their own document structure.

XML is not a replacement for HTML

XML is complementary to HTML.

It’s important to understand that XML will not replace HTML. In most web applications, XML is used to transmit data, while HTML is used to format and display the data.

The best description of XML is:

XML is an information transmission tool that is independent of software and hardware.

XML is a recommended standard by W3C

Extensible Markup Language (XML) became a W3C recommendation on February 10, 1998.

For more information on W3C XML activities, visit our W3C Tutorials.

XML is everywhere

When we see the rapid development progress of the XML standard and the rapid speed at which a large number of software developers adopt this standard, we can't help but sigh. This is really amazing.

Currently, XML plays a no less important role in the Web than HTML, which has always been the cornerstone of the Web.

XML is everywhere. XML is the most commonly used tool for data transfer between various applications and is becoming increasingly popular in the field of information storage and description.

2, HTML

What is HTML?

HTML is a language used to describe web pages.

  • HTML refers to Hypertext Markup Language (Hyper Text Markup Language)
  • HTML is not a programming language, but a markup language
  • A markup language is a set of markup tags
  • HTML uses markup tags to describe web pages

HTML tag

HTML tags are often called HTML tags.

  • HTML tags are keywords surrounded by angle brackets, such as
  • HTML tags usually appear in pairs, such as and
  • The first tag in a tag pair is the start tag and the second tag is the end tag
  • Opening and closing tags are also known as open tags and closing tags

 

HTML 文档 = 网页

  • HTML 文档描述网页
  • HTML 文档包含 HTML 标签和纯文本
  • HTML 文档也被称为网页

Web 浏览器的作用是读取 HTML 文档,并以网页的形式显示出它们。浏览器不会显示 HTML 标签,而是使用标签来解释页面的内容:

<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body>
</html>

例子解释

  • 与 之间的文本描述网页
  • 与 之间的文本是可见的页面内容
  • 之间的文本被显示为标题
  • 之间的文本被显示为段落

3、XHTML

 

 

什么是 XHTML?

 

  • XHTML 指的是可扩展超文本标记语言
  • XHTML 与 HTML 4.01 几乎是相同的
  • XHTML 是更严格更纯净的 HTML 版本
  • XHTML 是以 XML 应用的方式定义的 HTML
  • XHTML 是 2001 年 1 月发布的 W3C 推荐标准
  • XHTML 得到所有主流浏览器的支持

 

为什么使用 XHTML?

因特网上的很多页面包含了“糟糕”的 HTML。

如果在浏览器中查看,下面的 HTML 代码运行起来非常正常(即使它并未遵守 HTML 规则):

<html>
<head>
<title>This is bad HTML</title>
<body>
<h1>Bad HTML
<p>This is a paragraph
</body>

XML 是一种必须正确标记且格式良好的标记语言。

如果希望学习 XML,请阅读我们的 XML 教程。

今日的科技界存在一些不同的浏览器技术。其中一些在计算机上运行,而另一些可能在移动电话或其他小型设备上运行。小型设备往往缺乏解释“糟糕”的标记语言的资源和能力。

所以 - 通过结合 XML 和 HTML 的长处,开发出了 XHTML。XHTML 是作为 XML 被重新设计的 HTML。

与 HTML 相比最重要的区别:

文档结构

  • XHTML DOCTYPE 是强制性的
  • 中的 XML namespace 属性是强制性的
  • 、、 以及 <body> 也是强制性的</li> </ul> <h3>元素语法</h3> <ul> <li>XHTML 元素必须正确嵌套</li> <li>XHTML 元素必须始终关闭</li> <li>XHTML 元素必须小写</li> <li>XHTML 文档必须有一个根元素</li> </ul> <h3>属性语法</h3> <ul> <li>XHTML 属性必须使用小写</li> <li>XHTML 属性值必须用引号包围</li> <li>XHTML 属性最小化也是禁止的</li> </ul> </div> <p> </p> <div> <h2><!DOCTYPE ....> 是强制性的</h2> <p>XHTML 文档必须进行 XHTML 文档类型声明(XHTML DOCTYPE declaration)。</p> <p>您可以在 W3School 的标签参考手册中找到完整的 XHTML 文档类型。</p> <p><html>、<head>、<title> 以及 <body> 元素也必须存在,并且必须使用 <html> 中的 xmlns 属性为文档规定 xml 命名空间。</p> <p>下面的例子展示了带有最少的必需标签的 XHTML 文档:</p> <pre class="brush:php;toolbar:false"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Title of document</title> </head> <body> ...... </body> </html> </pre> </div> <p> </p> <div> <h2>如何从 HTML 转换到 XHTML</h2> <ol> <li>向每张页面的第一行添加 XHTML <!DOCTYPE></li> <li>向每张页面的 html 元素添加 xmlns 属性</li> <li>把所有元素名改为小写</li> <li>关闭所有空元素</li> <li>把所有属性名改为小写</li> <li>为所有属性值加引号</li> </ol> </div> <p> </p> <div> <h2>用 W3C 验证器检验 XHTML</h2> <p>在下面的文本框中输入您的网址:</p> <form action="http://validator.w3.org/check" method="get" target="_blank"> <p><input type="text" name="uri" value="http://www.w3school.com.cn/html/index.asp" size="60"></p> <p> </p> <p><span style="font-size: 18px; background-color: #ffcc00;"><strong>4、HTML5</strong></span></p> <p> </p> <h2>什么是 HTML5?</h2> <p>HTML5 将成为 HTML、XHTML 以及 HTML DOM 的新标准。</p> <p>HTML 的上一个版本诞生于 1999 年。自从那以后,Web 世界已经经历了巨变。</p> <p>HTML5 仍处于完善之中。然而,大部分现代浏览器已经具备了某些 HTML5 支持。</p> <div> <h2>HTML5 是如何起步的?</h2> <p>HTML5 是 W3C 与 WHATWG 合作的结果。</p> <p class="note">编者注:W3C 指 World Wide Web Consortium,万维网联盟。</p> <p class="note">编者注:WHATWG 指 Web Hypertext Application Technology Working Group。</p> <p>WHATWG 致力于 web 表单和应用程序,而 W3C 专注于 XHTML 2.0。在 2006 年,双方决定进行合作,来创建一个新版本的 HTML。</p> <p>为 HTML5 建立的一些规则:</p> <ul> <li>新特性应该基于 HTML、CSS、DOM 以及 JavaScript。</li> <li>减少对外部插件的需求(比如 Flash)</li> <li>更优秀的错误处理</li> <li>更多取代脚本的标记</li> <li>HTML5 应该独立于设备</li> <li>开发进程应对公众透明</li> </ul> </div> <div> <h2>新特性</h2> <p>HTML5 中的一些有趣的新特性:</p> <ul> <li>用于绘画的 canvas 元素</li> <li>用于媒介回放的 video 和 audio 元素</li> <li>对本地离线存储的更好的支持</li> <li>新的特殊内容元素,比如 article、footer、header、nav、section</li> <li>新的表单控件,比如 calendar、date、time、email、url、search</li> </ul> </div> </form> </div> <pre class="brush:php;toolbar:false"><!DOCTYPE HTML> <html> <body> <video width="320" height="240" controls="controls"> <source src="movie.ogg" type="video/ogg"> <source src="movie.mp4" type="video/mp4"> Your browser does not support the video tag. </video> </body> </html></pre> </div> <div id="MySignature"></div> <div class="clear"></div> </div><div class="nphpQianMsg"><div class="clear"></div></div><div class="nphpQianSheng"><span>Statement:</span><div>The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn</div></div></div><div class="nphpSytBox"><span>Previous article:<a class="dBlack" title="Research on CSS3 selectors" href="http://m.php.cn/faq/335473.html">Research on CSS3 selectors</a></span><span>Next article:<a class="dBlack" title="Research on CSS3 selectors" href="http://m.php.cn/faq/335475.html">Research on CSS3 selectors</a></span></div><div class="nphpSytBox2"><div class="nphpZbktTitle"><h2>Related articles</h2><em><a href="http://m.php.cn/article.html" class="bBlack"><i>See more</i><b></b></a></em><div class="clear"></div></div><ul class="nphpXgwzList"><li><b></b><a href="http://m.php.cn/faq/348757.html" title="Summary of Html knowledge" class="aBlack">Summary of Html knowledge</a><div class="clear"></div></li><li><b></b><a href="http://m.php.cn/faq/348804.html" title="How to learn HTML quickly" class="aBlack">How to learn HTML quickly</a><div class="clear"></div></li><li><b></b><a href="http://m.php.cn/faq/348873.html" title="The difference between html xhtml xml" class="aBlack">The difference between html xhtml xml</a><div class="clear"></div></li><li><b></b><a href="http://m.php.cn/faq/348884.html" title="The difference between src and href attributes" class="aBlack">The difference between src and href attributes</a><div class="clear"></div></li><li><b></b><a href="http://m.php.cn/faq/348902.html" title="About HTML5 and CSS replacement use" class="aBlack">About HTML5 and CSS replacement use</a><div class="clear"></div></li></ul></div></div><footer><div class="footer"><div class="footertop"><img src="/static/imghwm/logo.png" alt=""><p>Public welfare online PHP training,Help PHP learners grow quickly!</p></div><div class="footermid"><a href="http://m.php.cn/about/us.html">About us</a><a href="http://m.php.cn/about/disclaimer.html">Disclaimer</a><a href="http://m.php.cn/update/article_0_1.html">Sitemap</a></div><div class="footerbottom"><p> © php.cn All rights reserved </p></div></div></footer><script>isLogin = 0;</script><script type="text/javascript" src="/static/layui/layui.js"></script><script type="text/javascript" src="/static/js/global.js?4.9.47"></script></div><script src="https://vdse.bdstatic.com//search-video.v1.min.js"></script><link rel='stylesheet' id='_main-css' href='/static/css/viewer.min.css' type='text/css' media='all'/><script type='text/javascript' src='/static/js/viewer.min.js?1'></script><script type='text/javascript' src='/static/js/jquery-viewer.min.js'></script><script>jQuery.fn.wait = function (func, times, interval) { var _times = times || -1, //100次 _interval = interval || 20, //20毫秒每次 _self = this, _selector = this.selector, //选择器 _iIntervalID; //定时器id if( this.length ){ //如果已经获取到了,就直接执行函数 func && func.call(this); } else { _iIntervalID = setInterval(function() { if(!_times) { //是0就退出 clearInterval(_iIntervalID); } _times <= 0 || _times--; //如果是正数就 -- _self = $(_selector); //再次选择 if( _self.length ) { //判断是否取到 func && func.call(_self); clearInterval(_iIntervalID); } }, _interval); } return this; } $("table.syntaxhighlighter").wait(function() { $('table.syntaxhighlighter').append("<p class='cnblogs_code_footer'><span class='cnblogs_code_footer_icon'></span></p>"); }); $(document).on("click", ".cnblogs_code_footer",function(){ $(this).parents('table.syntaxhighlighter').css('display','inline-table');$(this).hide(); }); $('.nphpQianCont').viewer({navbar:true,title:false,toolbar:false,movable:false,viewed:function(){$('img').click(function(){$('.viewer-close').trigger('click');});}}); </script></body></html>