XML, HTML, XHTML, xmlhtmlxhtml

Source: Internet
Author: User

XML, HTML, XHTML, xmlhtmlxhtml
We often use the above three technologies. Here we will make a specific summary to compare them.

  • What is XML?
XML is Extentsible Markup Language (Extensible Markup Language). It is a metalanguage used to define other languages. Its predecessor is SGML (Standard Generic Markup Language ). It does not have a tag set or grammatical rule, but it has syntax rule ). Any XML document must be well-formed for any type of applications and correct parsing, that is, each opened tag must have a matched end tag, do not include tags in reverse order, and the statement composition should comply with the technical specifications. XML documents can be valid, but they are not necessarily required. A valid document is a document that complies with the document type definition (DTD. If a document complies with a schema, this document is schema valid ).
  • What is HTML?
The full combination of HTML is Hypertext Markup Language, and Chinese is also the Hypertext link Markup Language. HTML (HyperTextMark-upLanguage) is a hypertext markup language. It is a WWW Description Language. The purpose of designing the HTML language is to easily link the text or graphics stored in one computer with the text or graphics stored in another computer to form an organic whole, people don't have to consider whether the specific information is on the current computer or on other computers on the network. We only need to use the mouse to point an icon in a document, and the Internet will immediately jump to the content related to this icon, and this information may be stored in another computer on the network. HTML text is a descriptive text composed of HTML commands. HTML commands can describe text, graphics, animations, sounds, tables, links, and so on. The structure of HTML consists of the header and Body. The header describes the information required by the browser, and the Body contains the specific content to be described. In addition, HTML is a common network language, a simple and common fully-configured markup language. It allows web producers to create complex pages that combine text and images. These pages can be viewed by anyone else on the internet, regardless of the type of computer or browser they use.
  • What is XHTML?
XHTML refers to EXtensible HyperText Markup Language ). As the next generation of HTML, we can understand that XHTML is an upgraded version of HTML. XHTML is a transitional language of HTML like XML. It is more rigorous than HTML, and the HTML labels used by basic languages are removed, my colleagues have higher standards, such as strict tag nesting and tag termination. Different browser technologies exist in today's market. Some browsers run on computers, while some run on mobile phones and handheld devices. The latter has no ability or means to explain bad Markup languages. Therefore, by combining the strengths of HTML and XML, we get the markup language-XHTML, which can be used both now and in the future. XHTML can be read by all devices that support XML. At the same time, before other browsers upgrade to support XML, XHTML enables us to compile documents with good structures, these documents work well in all browsers and are backward compatible.
  • Comparison Between XML and HTML:
1. XML is designed to describe data. The key point is: what is data and how to store data. 2. HTML is designed to display data. The focus is on displaying data and how to display data better.
  • Relationship between HTML and XML:
1. In fact, there is no inevitable link between HTML and XML. XML is not to replace HTML. In fact, XML can be regarded as a supplement to HTML.
2. Different goals for XML and HTML: HTML is designed to display data and concentrate on the Data appearance. XML is designed to describe data and concentrate on data content.
3. Similar to HTML, XML does not perform any operations. Although the XML tag can be used to describe the structure of an item such as an order, it does not contain any code that can be used to send or process the order and ensure delivery by the order, others must write code to actually perform these operations on data in XML format. Unlike HTML, XML markup is defined by the author of the architecture or document and is unrestricted. HTML tags are predefined. HTML authors can only use tags supported by the current HTML standard.

4. Unlike HTML, XML markup is defined by the author of the architecture or document and is unrestricted. HTML tags are predefined. HTML authors can only use tags supported by the current HTML standard.

  • Comparison between HTML and XHTML:
As an upgraded version of HTML, XHTML certainly has more specifications. The details are as follows:
1. All tags must have an ending mark. Previously, in HTML, you can open many tags, such as <li> and not necessarily write corresponding sums </li> to close them. However, this is invalid in XHTML. XHTML requires a rigorous structure, and all labels must be disabled. If it is an unpaired tag, add "/" at the end of the tag to close it. For example, .
2. The element and attribute names of all tags must be in lower case. Unlike HTML, XHTML is case sensitive and <title> and <TITLE> are different tags. XHTML requires that all labels and attribute names must be in lower case. For example, <BODY> must be written as <body>. Case-insensitive inclusion is not recognized. Generally, the attribute name "onMouseOver" automatically generated by dreamweaver must be changed to "onmouseover ".
3. All XML tags must be reasonably nested. Similarly, because XHTML requires a rigorous structure, all nesting must be in order. Previously we wrote code like this: <p> <B> </p> </B> must be set to <p> <B> </p>. That is to say, the nesting layer by layer must be strictly symmetric.
4. All attributes must be enclosed in quotation marks. In HTML, you do not need to enclose attribute values in quotation marks, but in XHTML, they must be enclosed in quotation marks. For example, 5. encode all <and & special characters. Any minor sign (<), not part of the tag, must be encoded as & l t; any major sign (>), not part of the tag, must be encoded as & g t; any ampersand (&), not part of an object, must be encoded as & a m p. Note: There is no space between the above characters.
6. assign a value to all attributes. XHTML specifies that all attributes must have a value. If there is no value, it repeats itself. For example, <input type = "checkbox" name = "shirt" value = "medium" checked> must be changed: <input type = "checkbox" name = "shirt" value = "medium" checked = "checked"/>
7. Do not add "--" to the comment. "--" Can only occur at the beginning and end of the XHTML comment, that is, they are no longer valid in the content. For example, the following code is invalid: <! -- Here is the comment ----------- here is the comment -->: Replace the internal dotted line with an equal sign or space.
<! -- Here is the comment ============== here is the comment -->: some of the above specifications seem strange, but all this is to make our code have a unified and unique standard, so as to facilitate future data reuse.
8. The image must contain instructions. Each Image Tag must contain ALT instructions. // to be compatible with Firefox and IE browsers, try to use both alt and title tags. The simple alt tags are not illustrated in the picture below Firefox!
  • How to convert HTML to XHTML
  1. Add an XHTML <! DOCTYPE> to the webpage.
  2. Add the xmlns attribute to the html element of each page.
  3. Modify all elements to lowercase.
  4. Close all empty elements.
  5. Modify all attribute names to lowercase.
  6. Enclose all attribute values with quotation marks.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.