Quick Start Tutorial for XML

PHPz
Release: 2017-04-04 10:54:30
Original
1721 people have browsed it


Chapter 1 What is XML? Quick introduction to XML

1. What is XML? First, let's take a look at a piece of code

XML (Extensible Markup Language)

       ]>   0x584A  holle,world!   -> 跟随0x584A、学习XML.. ]]>  
Copy after login

Let's take a look at the specific display effect after running in the browser:

Quick Start Tutorial for XML

1.png

2.What is XML mainly used for?

I believe that students who have been online for a long time have seen files with the suffix .xml. This is what we call XML files.
First after HTML became popular, the W3C organization felt that the limitations of the HTML language were too great, so it introduced XML for the purpose of Replace HTML language .

Of course, it seems that W3C’s plan has not been successful. (However, there are no eggs⊙﹏⊙)

Although XML has not replaced HTML, its unique characteristics allow it to continue to this day. .

优点: 1. 高度自定义[标签] 2. 不同语言中的数据流通规范 3. XML是用来描述数据的。而在HTML中,数据是写在HTML标签中的。 4. XML设计是用来描述数据的:重点是什么是数据,怎么存放数据。而HTML则是用来显示数据:重点是怎么显示数据,及怎么更好的显示数据。
Copy after login

Explain XML in one sentence: XML is a cross-platform, software- and hardware-independent tool for processing information (a tool for data manipulation and data transmission)

Um.. Let me share a joke with you:

Q: When should I use XML?

Answer: You can write in your resume that you know XML..

3. Quick introduction to XML

Based on the first piece of code above , let us analyze it step by step.

Copy after login

The first one is to declare first, declare that this XML version is 1.0, and use UTF-8character set to identify it .

The following code is used for DTDconstraints.

          ]>
Copy after login

Then someone asked:

What is DTD?

Let’s take a look at the explanation on W3C:

Document type definition (DTD) can define legal XML document building blocks. It uses a series of legal elements to define the structure of the document.

Uh... (Actually, it's just bullshit, it's the same as not saying it...)

Okay, no more complaining. In fact, it sets restrictions on the XML elements, attributes, etc. we write. The structure we write must follow DTD constraints.


Let us continue to look at the following code:

  0x584A  holle,world!   -> 跟随0x584A、学习XML.. ]]>  
Copy after login

Did you find anything?

Yes, yes, it is a tree structure. Let's take a look at the DTD constraint. The root node class is first defined, and then the person element is defined and there are four elements inside the
person element. Elements name, time, msg, data.

There is a strange thing among them, we call it CDATA section, only the text in the section will be ignored by the parser, so it outputs it as isSpecial symbols<>, etc...

好了、至此关于XML的快速入门结束了,你学会了多少呢? 下一章让我们来学习XML的语法、元素及属性吧 o(∩_∩)o
Copy after login

The above is the detailed content of Quick Start Tutorial for XML. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!