Xml 简明教程

XML - Documents

XML 文档是 XML 信息的基本单元,由有序包装中的元素和其他标记组成。XML 文档可以包含种类繁多的数据。例如,数字数据库、表示分子结构的数字或数学方程式。

An XML document is a basic unit of XML information composed of elements and other markup in an orderly package. An XML document can contains wide variety of data. For example, database of numbers, numbers representing molecular structure or a mathematical equation.

XML Document Example

以下示例中显示了一个简单的文档 −

A simple document is shown in the following example −

<?xml version = "1.0"?>
<contact-info>
   <name>Tanmay Patil</name>
   <company>TutorialsPoint</company>
   <phone>(011) 123-4567</phone>
</contact-info>

下图说明了 XML 文档的各个部分。

The following image depicts the parts of XML document.

xml document

Document Prolog Section

Document Prolog 位于文档顶部,在根元素之前。此部分包含 −

Document Prolog comes at the top of the document, before the root element. This section contains −

  1. XML declaration

  2. Document type declaration

您可以在第 XML Declaration 章中了解有关 XML 声明的更多信息

You can learn more about XML declaration in this chapter − XML Declaration

Document Elements Section

Document Elements 是 XML 的构建模块。它们将文档划分成一系列部分,每部分都用于特定的目的。您可以将文档分成多个部分,以便以不同的方式呈现它们或供搜索引擎使用。这些元素可以是容器,其中包含文本和其他元素的组合。

Document Elements are the building blocks of XML. These divide the document into a hierarchy of sections, each serving a specific purpose. You can separate a document into multiple sections so that they can be rendered differently, or used by a search engine. The elements can be containers, with a combination of text and other elements.

您可以在第 XML Elements 章中了解有关 XML 元素的更多信息

You can learn more about XML elements in this chapter − XML Elements