Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

HTML vs. XML


May 30, 2021 Article blog


Table of contents


HTML (HyperText Markup Language): Is a hypertext markup language, hypertext markup language is a standard universal markup language under an exploit, but also a specification, a standard, which uses markers to mark the various parts of a Web page displayed in the minutes. A web file itself is a text file that tells the reader how to display its contents (e.g., how the text is handled, how the picture is arranged, how the picture is displayed, etc.) by adding markers to the text file.

XML :Extensible Markup Language): Expands the markup language, a subset of the standard universal markup language, and is a markup language used to mark electronic files to make them structural.

Uniform ResourceLocator: Unified Resource Locator is a concise representation of the location and access methods of resources available from the Internet, and is the address of standard resources on the Internet. E ach file on the Internet has a unique URL that includes information indicating the location of the file and what the reader should do with it. A nchor tags () are features in HTML that define the source and destination of hyperlinks. W e often use the tag and its href properties to define a source hyperlink. The value of this href property is the URL of the target.

HTML vs. XML

1, in fact, there is no very necessary link between HTML and XML, XML is not to replace HTML, in fact, XML can be regarded as a complement to HTML.

2, XML and HTML have different goals: HTML is designed to display data and focus on the appearance of the data, while XML is designed to describe the data and focus on the content of the data.

3. Similar to HTML, XML does nothing. Although an XML tag can be used to describe the structure of an item such as an order, it does not include any code that can be used to send or process the order and ensure delivery according to the order, and others must write code to actually perform these operations on the data in XML format.

4. Unlike HTML, XML tags are defined by the author of the schema or document and are infinite. HTML tags are predefined;

5, HTML and XML have many of the same frequently used character entities, as shown in the following illustration:

 HTML vs. XML1

Good habits

A well-formed xml file must do the following:

1, the document starts with the xml declaration

<?xml version="1.0"?>

This declaration cannot be preceded by spaces or other characters, i.e. <?xml version""1.0"?> must be on the first line of the xml file, the first column, and spaces cannot be included between <? and xml. Otherwise, it's all wrong.

2, xml can only include a unique root element

The correct example is the following:

<?xml version="1.0"?> <man> <head>head</head> <body>body</body> </man>

Examples of errors include two root elements< header >< body >

<?xml version="1.0"?> <head>head</head> <body>body</body>

3, the mark must be closed

4, empty mark convention

Representation: < empty marker/>

Empty tags can have properties

5, must be nested layer by layer

Child elements must be nested within the parent element and cannot be interlaced with each other.

Elements of the same layer must be side by side with each other and cannot be nested against each other.

6, identify case

The start and end tags of the element must be consistent.

7, property settings

The property must be set in quotation marks.

8, the representation of special characters

Use predefined entity borrowing to invoke:

Error writing:

<span style="font-size:24px;"><compare>3<6</compare></span>

Correctly written:

<span style="font-size:24px;"><compare>3  &lt;  6</compare></span>

There are also quality tutorials to make you the HTML god