1, XML
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 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 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.
The tags in the above example are not defined in any XML standard (such as
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
,
XML allows creators to define their own tags and their own document structure.
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.
Extensible Markup Language (XML) became a W3C recommendation on February 10, 1998.
For more information on W3C XML activities, visit our W3C Tutorials.
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
HTML is a language used to describe web pages.
HTML tags are often called HTML tags.
Web 浏览器的作用是读取 HTML 文档,并以网页的形式显示出它们。浏览器不会显示 HTML 标签,而是使用标签来解释页面的内容:
<html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html>
与
之间的文本被显示为段落3、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 文档必须进行 XHTML 文档类型声明(XHTML DOCTYPE declaration)。
您可以在 W3School 的标签参考手册中找到完整的 XHTML 文档类型。
、
、下面的例子展示了带有最少的必需标签的 XHTML 文档:
<!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>
在下面的文本框中输入您的网址:
<!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>