Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the differences between XML and HTML

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you what are the differences between XML and HTML, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

1. XML and HTML

XML (eXtensible Markup Language) is an extensible markup language, which is similar to the syntax of HTML language and belongs to markup language. So how on earth can you tell them apart?

1. Design difference

XML is designed to transfer and store data, focusing on the content of the data. HTML is designed to display data, and its focus is on the appearance of the data. It can be said that HTML is designed to display information, and XML is designed to transmit information.

2. Grammatical differences

(1) HTML has a variety of formats, and some tags can appear in pairs. XML requires that all tags appear in pairs.

(2) the label of HTML is fixed, the style is limited, XML can be extended, and the tag type can be defined by itself.

(3) HTML can have multiple tag headers, and XML can only have one tag header.

(4) HTML tags are not case-sensitive, while XML is case-sensitive.

2. Detailed explanation of XML

Remember the system configuration document used when developing the system? yes, it is the xml document. As the configuration file of the system, it is the main application of xml, and it can also be used to transfer data in Ajax or Web Services.

1. XML history

Before taking a closer look at the basic usage of XML, let's take a look at the history of markup languages.

The predecessor of XML is SGML (The Standard Generalized Markup Language), which is also optimized on the basis of HTML. SGML is a standard after GML collates the specification, but SGML is a very rigorous text description, which is too large and complex to understand. At the same time, W3C (World wide Web Alliance) also found some problems in HTML, such as inability to explain other forms of content such as audio-visual files and chemical formulas, and poor performance, poor scalability and so on. In order to solve the above problems, experts use SGML to make it easy, and develop XML according to the development experience of HTML.

2. XML usage

Let's first look at a XML instance.

XML/HTML Code copy content to clipboard 39.00 39.00 Java App 39.00

2.1 statement

A well-formed XML file starts with a XML declaration, as in the example above, which provides basic information about the document. Where encoding represents the character encoding used in XML files, and the encoding format of the XML document to be saved must be the encoding attribute value.

2.2 element

Elements are the start tag, the end tag, and everything in between.

And the basic composition of HTML, XML is also a basic tag composition, in which the format of the tag and HTML tag is the same, except that the XML tag has a start tag must have an end tag, and strictly case-sensitive. It allows nesting of label formats, but it must be nested correctly.

XML structure is a tree structure, its content must have only one root element, and other elements must be nested within the root element. For example, the one in the above example is the root element.

2.3 entity reference

Entity references print special symbols in XML documents in a specific format, similar to the text in CDATA below.

XML/HTML Code copies content to clipboard 39.00

Basic entity references are not detailed.

2.4 Special label

CDATA is a special label that enables everything in it to be printed out as text. The form is as follows:

XML/HTML Code copies content to clipboard 39.00

2.5 chowder

(1) the XML document is actually a tree-like structure sorted out by drawing, which is often opened with IE when displayed.

(2) the values of attributes in XML tags must be enclosed in quotation marks (single or double quotation marks, but must be consistent)

(3) xsl format can be used to beautify the display of xml in XML documents with complex internal structures.

Third, pay attention

1. Make a statement:

2. When saving, you should save the corresponding type according to the encoding type in encoding. Don't forget to choose the save type when saving.

3. There is only one top element

4. Case sensitivity

5. the value of the attribute must be enclosed in quotation marks (single or double quotation marks)

6. Have a beginning and an end

7. The nesting form should be correct.

The basic application of XML is discussed on the. XML is very simple. Is that all XML has? Of course not, as you can see from its basic name, it is also a programming language, so it should have some features of a programming language, such as templates in some languages or API in Java. Yes, XML can also define its own syntax structure, and can write template functions just like programming languages, but in XML it is called legal XML, which is what people call legal XML verified by DTD or Schema.

These are all the contents of this article entitled "what are the differences between XML and HTML". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report