XMLGetting started
# Basic overview
## Extensible Markup Language, a subset of Standard Universal Markup Language, is a markup language used to mark electronic files to make them structural. In electronic computers, tags refer to information symbols that computers can understand. Through such tags, computers can process various information such as articles, etc. It can be used to mark data and define data types. It is a source language that allows users to define their own markup language. It is ideally suited for World Wide Web transport, providing a unified approach to describing and exchanging structured data independent of applications or vendors. It is a cross-platform, content-dependent technology in the
environment, and it is also an effective tool for processing distributed structured information today. As early as 1998, W3C released the XML1.0 specification, Use it to simplify the transmission of document information on the Internet.
The historical origin of XML
In 1969
,GML(Generalized Markup Language Generalized Markup Language)---->In 1985,SGML(Standard Generalized Markup LanguageStandard Generalized Markup Language)---> ;1993年,HTML(Hypertext Markup LanguageHypertext Markup Language)--->1998 Year, XML(Extensible Markup LanguageExtensible Markup Language)
What is extensible markup language?
1
, Extensible Markup Language is a markup language that is very similar to Hypertext Markup Language.2
, It is designed to transmit data, not display data.3
, its label is not predefined. You need to define the labels yourself.4
, It is designed to be self-descriptive.5
, it is the recommended standard ofW3C.
What is the difference between Extensible Markup Language and Hypertext Markup Language?
1
, it is not a replacement for Hypertext Markup Language.2
, it is a supplement to Hypertext Markup Language.3
, It is designed for different purposes from Hypertext Markup Language:4
, It is designed to transmit and store data , whose focus is the content of the data.5
, Hypertext Markup Language is designed to display data, with the focus being on the appearance of the data.6
, Hypertext Markup Language is designed to display information, while it is designed to transmit information.7
. The best description of it is: it is an information transmission tool independent of software and hardware.
Why do you need
XML? 1
, solves the problem of non-standard data transmission.2
, can describe things in a tree structure very well.3
, can be used as a configuration file.PS
: Nowadays, many languages and technologies are using XML as data transmission standard, so a deep understanding of XML is equivalent to mastering a general data transmission protocol. Reference document:
http://www.php.cn/
Case:
<?xml version="1.0" encoding="UTF-8"?> <class> <stu id="a001"> <name>张三</name> <sex>男</sex> <age>20</age> </stu> <stu id="a002"> <name>李四</name> <sex>女</sex> <age>18</age> </stu> </class>
XML基本语法
一个XML文件可分为如下几部分内容:
文档声明 、元素、属性、注释 、CDATA区 ,特殊字符 、处理指令(processing instruction)
基本语法:
<?xml version="1.0" encoding="UTF-8"?> <!-- 上面是文档声明 - -> <?xml-stylesheet type="text/css" href=”XML2.css”?> <!-- 上面是处理指令 - -> <根元素> <!-- 注释 - -> <![CDATA[ CDATA区,可以是任意字符 ]]> <元素 属性=”属性值”> <元素>元素内容</元素> <空元素/>> </元素> </class>
文档声明
<?xml version="1.0" encoding=“编码方式" standalone="yes|no"?>
XML声明放在XML文档的第一行
XML声明由以下几个部分组成:
version - -文档符合XML1.0规范
encoding - -文档字符编码,比如”utf-8”
standalone - -文档定义是否独立使用
standalone="yes“
standalone=“no” 默认
PS:虽说现在XML出了2.0版了,但是现在大多还是用1.0版。
元素
基本语法:
<元素>元素内容</元素> <元素/>
注意事项:
1、每个XML文档必须有且只有一个根元素。
2、根元素是一个完全包括文档中其他所有元素的元素。
3、根元素的起始标记要放在所有其他元素的起始标记之前。
4、根元素的结束标记要放在所有其他元素的结束标记之后。
5、XML元素指XML文件中出现的标签,一个标签分为开始标签和结束标签,一个标签有如下几种书写形式,例如:
6、一个标签中也可以嵌套若干子标签。但所有标签必须合理的嵌套,绝对不允许交叉嵌套 ,例如:
7、对于XML标签中出现的所有空格和换行,XML解析程序都会当作标签内容进行处理。
例如:
8、一个XML元素可以包含字母、数字以及其它一些可见字符,但必须遵守下面的一些规范:
1---区分大小写,例如,和是两个不同的标记。
2---不能以数字或"_" (下划线)开头。
3---不能包含空格。
4---名称中间不能包含冒号(:)。
9、元素、标签、节点意义都是一样的。
属性
基本语法
<元素 属性1=”属性值” 属性2=”属性值”>元素内容</元素>
注意事项:
1、属性值用双引号(")或单引号(')分隔(如果属性值中有',用"分隔;有",用'分隔)
2、一个元素可以有多个属性,它的基本格式为:
3、属性名称在同一个元素标记中只能出现一次
4、属性值不能包括, &之类的特殊字符,否则需要使用转义字符。
注释
这个和HTML一样,都是

Advanced features of RSS include content namespaces, extension modules, and conditional subscriptions. 1) Content namespace extends RSS functionality, 2) Extended modules such as DublinCore or iTunes to add metadata, 3) Conditional subscription filters entries based on specific conditions. These functions are implemented by adding XML elements and attributes to improve information acquisition efficiency.

RSSfeedsuseXMLtostructurecontentupdates.1)XMLprovidesahierarchicalstructurefordata.2)Theelementdefinesthefeed'sidentityandcontainselements.3)elementsrepresentindividualcontentpieces.4)RSSisextensible,allowingcustomelements.5)Bestpracticesincludeusing

RSS and XML are tools for web content management. RSS is used to publish and subscribe to content, and XML is used to store and transfer data. They work with content publishing, subscriptions, and update push. Examples of usage include RSS publishing blog posts and XML storing book information.

RSS documents are XML-based structured files used to publish and subscribe to frequently updated content. Its main functions include: 1) automated content updates, 2) content aggregation, and 3) improving browsing efficiency. Through RSSfeed, users can subscribe and get the latest information from different sources in a timely manner.

The XML structure of RSS includes: 1. XML declaration and RSS version, 2. Channel (Channel), 3. Item. These parts form the basis of RSS files, allowing users to obtain and process content information by parsing XML data.

RSSfeedsuseXMLtosyndicatecontent;parsingtheminvolvesloadingXML,navigatingitsstructure,andextractingdata.Applicationsincludebuildingnewsaggregatorsandtrackingpodcastepisodes.

RSS documents work by publishing content updates through XML files, and users subscribe and receive notifications through RSS readers. 1. Content publisher creates and updates RSS documents. 2. The RSS reader regularly accesses and parses XML files. 3. Users browse and read updated content. Example of usage: Subscribe to TechCrunch's RSS feed, just copy the link to the RSS reader.

The steps to build an RSSfeed using XML are as follows: 1. Create the root element and set the version; 2. Add the channel element and its basic information; 3. Add the entry element, including the title, link and description; 4. Convert the XML structure to a string and output it. With these steps, you can create a valid RSSfeed from scratch and enhance its functionality by adding additional elements such as release date and author information.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Chinese version
Chinese version, very easy to use

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software