xml and databases

Post on 02-Jan-2016

27 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

XML and Databases. Data and Document. There are really at least two distinct XML uses XML to describe Documents XML to describe Data. Document vs Data. XML for documents describes complex document structures: many elements with mixed content data types usually just text. - PowerPoint PPT Presentation

TRANSCRIPT

XML and Databases

Data and Document

• There are really at least two distinct XML uses– XML to describe Documents– XML to describe Data

Document vs Data

XML for documents describes complex document structures: many elements with mixed content data types usually just text

Data XML, simpler describing data structure, No or little mixed content: data types varied and important

Document processing

Machine to machine communication

XML Data

• Xml for data is usually simpler—more straight forward in structure: less hierarchical levels, no, or very few mixed elements

• It is meant to be generated and read by applications

• Data types are more important—thus the use of schemas rather than DTDs

Reasons for XML

• Explosion in the need to share data over the Internet from enterprise databases

• Different database softwares, application softwares, incompatible data schemas

• XML provides an easily managed format for universal communication

Universal Communication

Application and platform independent data format

Unicode Multilanguage support

Data logic separate from presentation logic

Importance to Database

• David Kroenke* lists these ways in which XML is important for databases– Standard means for representing domains– Standard means for expressing database

views– Clean separation of structure, content and

materialization– Facility for document validity checking– Industry standards for document types*Kroenke, David Database Processing, Eighth Edition: Prentice Hall, NJ, 2001,

p 432

Issues

• XML does not always translate well to relational data models

• XML has a primarily hierarchical structure

• Some sort of “Data Mapping” must occur

Data Mapping

Database server SQL

Mapping to XML

XML application

Approaches to Data Mapping

• Result set mapping—maps the XML to the result set of an SQL Query. (A row element is created for each record. Each column becomes an element or attribute)

• Schema mapping—the database structure is generated to and from XML Schema (we will cover this more later)

Commercial Database Support

• SQL Server—can generate XML from SQL and can update tables from XML files.

• Oracle 9-I includes XSU (XML SQL Utility that will– Generate XML based on SQL queries– Extract data from XML for insert or

update

XML Databases

• There has been some talk of creating XML databases—that is a database whose native format is XML and which processes queries with XPath and XQuery

• There has also been some movement to include XML as a native Data type in Relational databases

The Gist

• XML is best used to communicate data

• Databases are best used to store data

top related