Transcript cos346day24
COS 346
Day 24
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-1
Agenda
• Questions?
• Quiz 3 Corrected
– 1 A, 2 B’s and 4 C’s
• Quiz 4 is on May 4
– DP Chap 12 13 & 15
– Skipping chapter 14
•
•
•
•
•
Capstone Progress reports Due
Assignment 9 is Due
Assignment 10 is posted due May 1
Assignment 11 is posted due May 4
Capstones projects and presentations are due May
12 at 10AM
• Today we will be discussing XML and ADO.NET
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-2
David M. Kroenke’s
Database Processing:
Fundamentals, Design, and Implementation
Chapter Thirteen:
XML and ADO.NET
Part One
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-3
Introduction
• Database processing and document processing
need each other.
– Database processing needs document processing
for transmitting database views.
– Document processing needs database processing
for storing and manipulating data.
• As Internet usage increases, organizations want
to make their Web pages more functional by
displaying and updating data from organizational
databases.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-4
XML
• XML, or Extensible Markup Language, was developed
in early 1990s:
– XML is a subset of SGML, or Standard Generalized Markup
Language.
• Today XML is a hybrid of document processing and
database processing.
– It provides a standardized yet customizable way to describe the
content of documents.
– XML documents can automatically be generated from database
data, and vice versa.
• SOAP (which formerly stood for Simple Object Access
Protocol but is now just a name instead of an acronym)
is an XML-based standard protocol for sending
messages of any type, using any protocol over the
Internet.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-5
XML (Continued)
• XML is used for describing, representing, and
materializing database views.
• XML is better than HTML because:
– It provides a clear separation between document structure,
content, and materialization.
– It is standardized but allows for extension by developers
– XML tags accurately represent the semantics of their data.
• Document Type Declarations (DTDs) and
XML Schemas can be used to describe the content of
XML documents.
• Both Oracle and SQL Server can produce XML
documents from database data.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-6
XML DTD
• An XML document consists of two sections:
– Document Type Declaration (DTD).
• The DTD begins with DOCTYPE <document_type_name>
– Document data.
• An XML document can be:
– Type-valid if the document conforms to its DTD.
– Well-formed and not type-valid, if
• It violates the structure of its DTD, or
• It has no DTD.
• A DTD may be stored externally so many documents can
be validated against the same DTD.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-7
XMLSpy
• The diagrams in the text and in the
following slides were prepared with
Altova’s XMLSpy.
• There is a free Home version of XMLSpy
2006 available at:
http://www.altova.com/download_compone
nts.html
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-8
XML Document with Internal DTD
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-9
XML Document with External DTD
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-10
External DTD for CustomerList
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-11
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-12
XML Document with Two Customers
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-13
XSLT
• XSLT, or the Extensible Style Language may be used
to materialize (transform) XML documents using XSL
document.
– From XML documents into HTML or into XML in another format.
• XSLT is a declarative transformation language:
– Declarative: create rules, not procedures, to materialize the
document.
– Transformational: transforms the input document into another
document.
• XSLT uses stylesheets to indicate how to transform the
elements of the XML documents into another format.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-14
Example XSL Stylesheet
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-15
Example HTML in Browser
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-16
David M. Kroenke’s
Database Processing
Fundamentals, Design, and Implementation
(10th Edition)
End of Presentation:
Chapter Thirteen Part One
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-17
David M. Kroenke’s
Database Processing:
Fundamentals, Design, and Implementation
Chapter Thirteen:
XML and ADO.NET
Part Two
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-18
XML Schema
• XML Schema is a standard for describing the content of
an XML document, i.e., defining custom vocabularies:
– Documents that conform to an XML Schema are called schemavalid.
– An XML document can be well-formed and be neither type-valid
nor schema-valid.
• Unlike DTDs, XML Schema documents are themselves
XML documents that can be validated against the
schema maintained by W3C.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-19
XML Schema Document
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-20
Schema-Valid XML Document
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-21
Elements and Attributes
• Schemas consist of elements and attributes:
– Elements are used to carry data and attributes are
used to carry metadata.
• Two types of elements:
– Simple elements have a single data value.
– ComplexType elements can have one or more
simple or ComplexType elements.
• ComplexType elements can have attributes.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-22
Flat Schemas:
XML Schema
• Flat schemas have all elements at the same
level:
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-23
Flat Schemas:
Schema-Valid Document
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-24
Flat Schemas:
SGraphical Representation of Schema
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-25
Structured Schemas:
XML Schema
• Structured
schemas
have
defined
subgroups:
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-26
Structured Schemas:
Schema-Valid Document
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-27
Structured Schemas:
Graphical Representation of Schema
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-28
David M. Kroenke’s
Database Processing
Fundamentals, Design, and Implementation
(10th Edition)
End of Presentation:
Chapter Thirteen Part Two
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
13-29