search
HomeBackend DevelopmentXML/RSS TutorialDetailed explanation of several easily confused concepts in XML database

  当开发人员谈及xml数据库时,他们往往指的是两个概念:存储XML数据的数据库,利用XML数据库的DBMS。绝大多数主要的DBMS产品允许你无需改变现有的数据库就可以集成XML数据到程序中。现在让我们讨论一下XML数据库并探讨其特性。

  原始的XML数据库

  一个原始的XML数据库(NXD)可以是很简单,也可以是很复杂。我这样定义一个数据库的概念:永久稳定数据的集合。在这样的定义下,一个NXD能在逻辑上存储一个XML文档。当XML:DB initiative对一个NXD还有更多的要求时,我想以上的定义也可以满足。

  以下的代码行可以用作于一个NXD:

〈?xml version=”1.0”?〉
  〈diet〉
  〈meal mealName=”breakfast”〉
  〈item itemName=“toast” unit=”slice” quantity=“2” /〉
  〈item itemName=“bacon” unit=”strip” quantity=“2” /〉
  〈/meal〉
  〈/diet〉

很显然,数据的集合以XML格式存储。如果它被存放在一个flat文件,它也会满足我们对NXD的定义:永久稳定数据的集合。

  一个NXD使用相同的方式来存储XML文档(比如:flat文件,关系数据库或级别数据库,对象数据库)。

  Flat文件

  一个简单的flat文件是一个最简单的XML数据库模型。作为一种“变种”,你可以存储很多XML文档在一个目录层次。为了扩展前面的范例,看看以下的模型:

Diets\
Diets\Atkins
Day1.xml
Day2.xml
Day3.xml
Day4.xml
Diets\3DayDiet
Day1.xml
Day2.xml
Day3.xml

Diets目录包含了子目录,并且每一子目录很多XML的flat文件。

  关系数据库

  关系数据库中的XML数据库可以分为三种模型:coarse-grained(粗糙纹理型), medium-grained(中等级别纹理型),或 fine-grained(优良纹理型)。

  coarse-grained(粗糙纹理型)模型在逻辑上与flat文件模型有些不同。你可以使用一个关系数据库来存放每一个XML文档。例如,以下的代码可以存放一个XML文档:

Create table diets
  ( dietName varchar2(30),
   xmlDocument varchar2(32000)
  )

fine-grained(优良纹理型)模型将XML文档的每一成分映射到关系数据库中。为了能够将flat模型转移到关系数据库,你必须使用两种改变方式。对以上的范例,你不能再使用子目录名来代表diet的名称,你也不能再使用文件的名称来传递diet的日期。表A显示了diet的XML文档的文件类型定义(DTD);表B显示了将DTD映射到关系表的数据定义语言(DDL)。除此之外,表C还包括了相应的XML语法。

  medium-grained(中等级别纹理型)模型介于coarse-grained(粗糙纹理)模型与 fine-grained(优良纹理)模型之间。使用这一模型,你可以将信息存储在meals 表的xml_items列中。

  对象数据库

  你也可以通过使用一个对象数据库来执行NXD。有些对象数据库是基于文档对象模型(DOM),这允许XML与数据库有紧密的结合。例如,一旦你提供一个食物方面的DTD,你可以开始保存这些食物,而不需要额外的配置。

  数据库管理系统

  对于DBMS,你可以有多种选择。你可以通过使用开放程序如eXist或Ozone来建立自己的DBMS,或者购买商业产品如Tamino XML Server。

  绝大多数关系数据库卖主都使他们的数据库能够使用XML,至少的,XML数据库(XEDBs)能够返回XML文档查询的结果。另外很多也可以保存XML数据。例如,Oracle 提供了一个XML剖析器,一个Xpath引擎,一个XSLT处理器,一个XMLSQL工具,以及使用XML的方法。

  所以,使用关系数据库存储的NXD和存储XML数据的XEDB有什么区别呢?一个NXD是基于XML文档概念而建立,而XEDB与其它没有过多的关联。而且,很多规范适用于NXD,而DBMS只适用标准的查询和存储数据的XML文档,比如Xpath。

  XML数据库不是新概念

  XML数据库在逻辑观点上不是新概念,虽然在逻辑执行上是新的。如果你想要执行一个XML数据库,你可以使用NXD,XEDB,或者是二者的结合。然而,如果你所在的公司对现有的数据库已经有一定的投资,你所做的第一个调查就是核实你的DMBS卖主是否提供使用XML的工具。无论你使用的哪一种XML数据库方式,你都要非常理解每一种数据库的特性,这才是最重要的。

以上就是关于XML数据库中几个容易混淆的概念详解的内容,更多相关内容请关注PHP中文网(www.php.cn)!


Statement
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
RSS in XML: Unveiling the Core of Content SyndicationRSS in XML: Unveiling the Core of Content SyndicationApr 22, 2025 am 12:08 AM

The implementation of RSS in XML is to organize content through a structured XML format. 1) RSS uses XML as the data exchange format, including elements such as channel information and project list. 2) When generating RSS files, content must be organized according to specifications and published to the server for subscription. 3) RSS files can be subscribed through a reader or plug-in to automatically update the content.

Beyond the Basics: Advanced RSS Document FeaturesBeyond the Basics: Advanced RSS Document FeaturesApr 21, 2025 am 12:03 AM

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.

The XML Backbone: How RSS Feeds are StructuredThe XML Backbone: How RSS Feeds are StructuredApr 20, 2025 am 12:02 AM

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

RSS & XML: Understanding the Dynamic Duo of Web ContentRSS & XML: Understanding the Dynamic Duo of Web ContentApr 19, 2025 am 12:03 AM

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: The Foundation of Web SyndicationRSS Documents: The Foundation of Web SyndicationApr 18, 2025 am 12:04 AM

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.

Decoding RSS: The XML Structure of Content FeedsDecoding RSS: The XML Structure of Content FeedsApr 17, 2025 am 12:09 AM

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.

How to Parse and Utilize XML-Based RSS FeedsHow to Parse and Utilize XML-Based RSS FeedsApr 16, 2025 am 12:05 AM

RSSfeedsuseXMLtosyndicatecontent;parsingtheminvolvesloadingXML,navigatingitsstructure,andextractingdata.Applicationsincludebuildingnewsaggregatorsandtrackingpodcastepisodes.

RSS Documents: How They Deliver Your Favorite ContentRSS Documents: How They Deliver Your Favorite ContentApr 15, 2025 am 12:01 AM

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.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools