Home  >  Article  >  Web Front-end  >  Message format: xml, fixed-length message, variable-length message

Message format: xml, fixed-length message, variable-length message

WBOY
WBOYOriginal
2016-09-24 09:02:462951browse

There are three message formats currently encountered: xml, fixed-length message, and variable-length message.

This is just a brief introduction. In the future, you should learn more about how to analyze the three, and then continue to update. ——2016.9.23

XML

XML is designed to transmit and store data.

HTML is designed to display data.

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

Example:

XML 使用简单的具有自我描述性的语法:<br /><br /><?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>George</to>
<from>John</from>
<heading>Reminder</heading>
<body>Don't forget the meeting!</body>

 

The tags in the above example are not defined in any XML standard (such as 05034471df6398a62d5708f78b78e0ac and 66fd2ada9ebb04d4250c850dc1e3737e). 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 e388a4556c0f65e1904146cc1a846bee , 4a249f0d628e2318394fd9b75b4636b1 , etc.).

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

Advantages and disadvantages:

High readability and easy to maintain;

International standard format, not easy to be intercepted by firewalls;

The node is bloated, takes up a lot of memory, and transfers slowly.

Fixed length message

 The most widely used message at present.

 Definition: Use a fixed length to represent a piece of information. Fixed length means fixed length, that’s how I understand it for the time being.

Advantages: Eliminate redundant nodes and transmit data faster.

 Limitations: Worry that the length of the defined domain will be lengthened in the future, and the configuration or program will change accordingly, making maintenance difficult.

Example:

For example, define an 18-byte message: abcde12345fghigklm

abcde is a domain, 12345 is a domain, and fghigklm is a domain. These are defined by the writer. If business requirements require adding a date to the message, the message needs to be modified to: abcde12345fghigklm20160923, which is now a 26-byte message.

If the fixed-length message contains multiple fields, and the formats of the fields are changed later, this situation highlights the limitations of the fixed-length message.

Variable length message

Combines the maintainability of xml and the small space occupied by fixed-length messages.

<span style="color: #008080;">1</span> <span style="color: #000000;">例子:03abc051234502ef
</span><span style="color: #008080;">2</span> 说明:03  此域的长度标识(没有规范命名,暂且成为长度标识),向后取3位,即:abc<br>3     05  此域的长度标识,向后取5位,即: 12345<br>4       02  向后取2位,即: ef

Statement:
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
Previous article:What the hell is this?Next article:What the hell is this?