xml and databases

13
XML and Databases

Upload: hayes-chase

Post on 02-Jan-2016

27 views

Category:

Documents


1 download

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

Page 1: XML and Databases

XML and Databases

Page 2: XML and Databases

Data and Document

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

Page 3: XML and Databases

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

Page 4: XML and Databases

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

Page 5: XML and Databases

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

Page 6: XML and Databases

Universal Communication

Application and platform independent data format

Unicode Multilanguage support

Data logic separate from presentation logic

Page 7: XML and Databases

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

Page 8: XML and Databases

Issues

• XML does not always translate well to relational data models

• XML has a primarily hierarchical structure

• Some sort of “Data Mapping” must occur

Page 9: XML and Databases

Data Mapping

Database server SQL

Mapping to XML

XML application

Page 10: XML and Databases

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)

Page 11: XML and Databases

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

Page 12: XML and Databases

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

Page 13: XML and Databases

The Gist

• XML is best used to communicate data

• Databases are best used to store data