可扩展标记语言xml总结
XML stands for eXtensible Markup Language. It is extensible, because unlike HTML, it does not use a predefined set of tags for identifying structural components. Instead, it provides a mechanism for users to define tags themselves.
XML代表可扩展标记语言。 它是可扩展的,因为与HTML不同,它不使用预定义的标签集来标识结构组件。 相反,它为用户提供了一种自行定义标签的机制。
XML was designed to simplify data sharing and data transport, and focuses on structuring that information in a logical way.
XML旨在简化数据共享和数据传输,并致力于以逻辑方式构造信息。
XML的语法 (Syntax of XML)
The syntax for XML is very straight forward and quite easy to learn.
XML的语法非常简单,而且很容易学习。
XML documents must contain one root element that is the parent of all other elements:
XML文档必须包含一个根元素,该根元素是所有其他元素的父元素:
<root>
<child>
<subchild>.....</subchild>
</child>
</root>
Above syntax shows the root element which is necessary while creating an XML code.
上面的语法显示了在创建XML代码时必需的根元素。
But the root element can be called anything. For example:
但是根元素可以称为任何东西。 例如:
<?xml version="1.0" encoding="UTF-8"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
In the code above <note>
is the root element.
在上面的代码中, <note>
是根元素。
Advantages of using XML:
使用XML的优点:
- Simplicity - XML documents are ordinary text files that can be created and edited with any text editor. 简单性-XML文档是可以使用任何文本编辑器创建和编辑的普通文本文件。
- Vendor independence 供应商独立性
- Platform independence 平台独立性
- Extensive infrastructure 广泛的基础设施
Disadvantages of using XML:
使用XML的缺点:
- Verbose and cumbersome syntax 繁琐繁琐的语法
- Highly inefficient storage 效率极低的存储
翻译自: https://www.freecodecamp.org/news/an-introduction-to-extensible-markup-language-xml/
可扩展标记语言xml总结