Xml 简明教程

XML - Databases

XML Database 用于以 XML 格式存储大量的信息。随着各个领域中对 XML 的使用日益增多,需要有一个安全的地方来存储 XML 文档。存储在数据库中的数据可以使用 XQuery 查询、序列化并导出为所需的格式。

XML Database is used to store huge amount of information in the XML format. As the use of XML is increasing in every field, it is required to have a secured place to store the XML documents. The data stored in the database can be queried using XQuery, serialized, and exported into a desired format.

XML Database Types

有两种主要的 XML 数据库 −

There are two major types of XML databases −

  1. XML- enabled

  2. Native XML (NXD)

XML - Enabled Database

支持 XML 的数据库只不过是为 XML 文档转换提供的扩展。这是一个关系数据库,其中数据存储在由行和列组成的表中。表包含一组记录,而记录又包含字段。

XML enabled database is nothing but the extension provided for the conversion of XML document. This is a relational database, where data is stored in tables consisting of rows and columns. The tables contain set of records, which in turn consist of fields.

Native XML Database

原生 XML 数据库基于容器而不是表格格式。它可以存储大量的 XML 文档和数据。原生 XML 数据库通过 XPath 表达式查询。

Native XML database is based on the container rather than table format. It can store large amount of XML document and data. Native XML database is queried by the XPath-expressions.

原生 XML 数据库比启用 XML 的数据库有优势。它非常有能力存储、查询和维护 XML 文档,而启用 XML 的数据库则不能。

Native XML database has an advantage over the XML-enabled database. It is highly capable to store, query and maintain the XML document than XML-enabled database.

Example

以下示例演示了 XML 数据库 −

Following example demonstrates XML database −

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

   <contact2>
      <name>Manisha Patil</name>
      <company>TutorialsPoint</company>
      <phone>(011) 789-4567</phone>
   </contact2>
</contact-info>

这里创建了一个联系人表,其中包含联系人的记录(contact1 和 contact2),而联系人记录又包含三个实体 − 名称、公司和电话。

Here, a table of contacts is created that holds the records of contacts (contact1 and contact2), which in turn consists of three entities − name, company and phone.