4/20/2017.

Slides:



Advertisements
Similar presentations
XML: Extensible Markup Language
Advertisements

XML DOCUMENTS AND DATABASES
XML: Extensible Markup Language. Slide Chapter Outline Introduction Structured, Semi structured, and Unstructured Data. XML Hierarchical (Tree)
3 November 2008CIS 340 # 1 Topics To define XML as a technology To place XML in the context of system architectures.
CS 898N – Advanced World Wide Web Technologies Lecture 21: XML Chin-Chih Chang
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
1 Lecture 10 XML Wednesday, October 18, XML Outline XML (4.6, 4.7) –Syntax –Semistructured data –DTDs.
Summary. Chapter 9 – Triggers Integrity constraints Enforcing IC with different techniques –Keys –Foreign keys –Attribute-based constraints –Schema-based.
XML Introduction What is XML –XML is the eXtensible Markup Language –Became a W3C Recommendation in 1998 –Tag-based syntax, like HTML –You get to make.
4/17/2017.
XML(EXtensible Markup Language). XML XML stands for EXtensible Markup Language. XML is a markup language much like HTML. XML was designed to describe.
XML –Query Languages, Extracting from Relational Databases ADVANCED DATABASES Khawaja Mohiuddin Assistant Professor Department of Computer Sciences Bahria.
Tutorial 11 Creating XML Document
1 Advanced Topics XML and Databases. 2 XML u Overview u Structure of XML Data –XML Document Type Definition DTD –Namespaces –XML Schema u Query and Transformation.
ECA 228 Internet/Intranet Design I Intro to XML. ECA 228 Internet/Intranet Design I HTML markup language very loose standards browsers adjust for non-standard.
XML – Data Model, DTD and Schema
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 XML Taken from Chapter 7.
XML Anisha K J Jerrin Thomas. Outline  Introduction  Structure of an XML Page  Well-formed & Valid XML Documents  DTD – Elements, Attributes, Entities.
Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.
1 COS 425: Database and Information Management Systems XML and information exchange continued Last time: XML document structure XML querying with XQuery.
Lecture 6 of Advanced Databases XML Schema, Querying & Transformation Instructor: Mr.Ahmed Al Astal.
XP 1 CREATING AN XML DOCUMENT. XP 2 INTRODUCING XML XML stands for Extensible Markup Language. A markup language specifies the structure and content of.
WORKING WITH XSLT AND XPATH
XML Overview. Chapter 8 © 2011 Pearson Education 2 Extensible Markup Language (XML) A text-based markup language (like HTML) A text-based markup language.
Chapter 26 XML and Internet Databases Copyright © 2004 Pearson Education, Inc.
CISC 3140 (CIS 20.2) Design & Implementation of Software Application II Instructor : M. Meyer Address: Course Page:
1 © Netskills Quality Internet Training, University of Newcastle Introducing XML © Netskills, Quality Internet Training University.
XP 1 DECLARING A DTD A DTD can be used to: –Ensure all required elements are present in the document –Prevent undefined elements from being used –Enforce.
 XML is designed to describe data and to focus on what data is. HTML is designed to display data and to focus on how data looks.  XML is created to structure,
Chapter 27 The World Wide Web and XML. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.27-2 Topics in this Chapter The Web and the Internet.
Avoid using attributes? Some of the problems using attributes: Attributes cannot contain multiple values (child elements can) Attributes are not easily.
1 Chapter 10: XML What is XML What is XML Basic Components of XML Basic Components of XML XPath XPath XQuery XQuery.
XML 2nd EDITION Tutorial 1 Creating An Xml Document.
Copyright © 2004 Pearson Education, Inc.. Chapter 26 XML and Internet Databases.
XML Documents Chao-Hsien Chu, Ph.D. School of Information Sciences and Technology The Pennsylvania State University Elements Attributes Comments PI Document.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 27 XML: Extensible Markup Language.
5 - 1 Copyright © 2006, The McGraw-Hill Companies, Inc. All rights reserved.
1 Introduction  Extensible Markup Language (XML) –Uses tags to describe the structure of a document –Simplifies the process of sharing information –Extensible.
XP 1 Creating an XML Document Developing an XML Document for the Jazz Warehouse XML Tutorial.
Copyright © 2004 Ramez Elmasri and Shamkant Navathe Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 26-2 Introduction Although.
Chapter 27 The World Wide Web and XML. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.27-2 Topics in this Chapter The Web and the Internet.
An Introduction to XML Sandeep Bhattaram
XML Introduction. What is XML? XML stands for eXtensible Markup Language XML stands for eXtensible Markup Language XML is a markup language much like.
XML Design Goals 1.XML must be easily usable over the Internet 2.XML must support a wide variety of applications 3.XML must be compatible with SGML 4.It.
1 XML eXtensible Markup Language. 2 XML vs. HTML HTML is a HyperText Markup language HTML is a HyperText Markup language Designed for a specific application,
XML Introduction. Markup Language A markup language must specify What markup is allowed What markup is required How markup is to be distinguished from.
1 Tutorial 11 Creating an XML Document Developing a Document for a Cooking Web Site.
The Semistructured-Data Model Programming Languages for XML Spring 2011 Instructor: Hassan Khosravi.
CS 157B: Database Management Systems II February 11 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron.
1 Indexing The syntax for creating a index is: CREATE [UNIQUE] INDEX index_name ON table_name (column1, column2,... column_n) [ COMPUTE STATISTICS ]; Why.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 1COMP9321, 15s2, Week.
XML CSC1310 Fall HTML (TIM BERNERS-LEE) HyperText Markup Language  HTML (HyperText Markup Language): December  Markup  Markup is a symbol.
XP Tutorial 9New Perspectives on HTML and XHTML, Comprehensive 1 Working with XHTML Creating a Well-Formed Valid Document Tutorial 9.
Working with XML. Markup Languages Text-based languages based on SGML Text-based languages based on SGML SGML = Standard Generalized Markup Language SGML.
Lecture 23 XQuery 1.0 and XPath 2.0 Data Model. 2 Example 31.7 – User-Defined Function Function to return staff at a given branch. DEFINE FUNCTION staffAtBranch($bNo)
C Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Introduction to XML Standards.
Introduction to XML Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
SEMI-STRUCTURED DATA (XML) 1. SEMI-STRUCTURED DATA ER, Relational, ODL data models are all based on schema Structure of data is rigid and known is advance.
CHAPTER NINE Accessing Data Using XML. McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Introduction The eXtensible.
XML – Basic Concepts (modified version from Dr. Praveen Madiraju) 2015, Fall Pusan National University Ki-Joune Li.
XML Extensible Markup Language
1 XML eXtensible Markup Language. 2 Introduction and Motivation Dr. Praveen Madiraju Modified from Dr.Sagiv’s slides.
XML Databases Presented By: Pardeep MT15042 Anurag Goel MT15006.
XML: Extensible Markup Language Abeiku Duncan Leslie Salami Anthony Mensah-Kumah Michelle Amarteifio Joseph Owusu-Badu.
XML: Extensible Markup Language
XML: Extensible Markup Language
Database Processing with XML
2/18/2019.
CSE591: Data Mining by H. Liu
Presentation transcript:

4/20/2017

XML and Internet Databases Chapter 26 XML and Internet Databases

Outline Structured, Semistructured, & Unstructured Data XML Hierarchical Data Model XML Document, DTD, & XML Schema XML Documents & Databases XML Querying

Structured vs Semistructured Data e.g., information stored in databases; all records have the same format as defined in the relational schema Semistructured data may have a certain structure but no all the information collected will have identical structure.

FIGURE 26.1 Representing semistructured data as a graph.

FIGURE 26.2 Part of an HTML document representing unstructured data (c.f., the company database schema)

XML Hierarchical (Tree) Data Model Problem with HTML document: Difficult to interpret automatically by programs because they do not include schema information about the type of data in the documents Inappropriate as intermediate Web documents to be exchanged among various computer sites Solution  XML documents Two main structuring concepts: elements, attributes c.f., In XML, tag names are defined to describe the meaning of the data elements, rather than to describe how the text is to be displayed (as in HTML).

FIGURE 26.3 A complex XML element called <projects>. Standalone=“yes” - schemaless Correction: <project> Complex elements: <projects>, <project>, <Worker> Simple elements: <Name>, <Number>, <SSN>, …

XML Documents, DTD, and XML Schema A well-formed XML document is one that follows a few conditions. Start with an XML declaration (version, …) Tree model A single root element Matching start and end tags for an element must be within the tags of the parent element Syntactically correct

XML Documents, DTD, and XML Schema A valid XML document is well formed, and in addition the element names used in the start and end tag pairs must follow the structure specified in a separate XML DTD (Document Type Definition) file or XML schema file. Figure 26.4: a sample XML DTD called projects * Zero or more, + one or more, ? Zero or one Otherwise: exactly once (data type) (#PCDATA) parsed character data

FIGURE 26.4 An XML DTD file called projects To use the DTD file: Store the DTD file in the same file system as the XML document <?xml version=“1.0” standalone=“no”?> <!DOCTYPE projects SYSTEM “proj.dtd”>

DTD Limitations Data types in DTD are not very general Has its own special syntax and thus requires specialized processors All DTD elements are always forced to follow the specified ordering of the documents, so unordered elements are not permitted. Solution  XML Schema

FIGURE 26.5 An XML schema file called company  Schema namespace  the root element company; also an unnamed complex element “Department”, “Employee”, etc. must be named types. The selector “employeeDependent” is an attribute of “Employee”, of type “Dependent”. The field “dependentName” in “Dependent” must be unique.

FIGURE 26.5 (continued) An XML schema file called company. <xsd:uniqu …> specifies a key constraint for non-primary key element. <xsd:key> specifies a primary key. <xsd:keyref> specifies a foreign key; <xsd:selector> refers to the referencing element type; <xsd:field> refers to the referencing attribute.

FIGURE 26.5 (continued) An XML schema file called company Exercise: Define the element “projectWorker” in the type “Project” as an embedded sub-element. Answer: <xsd:element name=“projectWorker” minOccurs=“1” maxOccurs=“unbound”> <xsd:sequence> <xsd:element name=“SSN” type=“xsd:string” /> <xsd:element name=“hours” type=“xsd:float” /> </xsd:sequence> </xsd:element>

FIGURE 26.5 (continued) An XML schema file called company

XML Documents and Databases Approaches to Storing XML Documents Extracting XML Documents from Relational Databases Breaking Cycles to Convert Graphs into Trees Other Steps for Extracting XML Documents from Databases

FIGURE 26.6 An ER schema diagram for a simplified UNIVERSITY database.

FIGURE 26.7 Subset of the UNIVERSITY database schema needed for XML document extraction.

FIGURE 26.8 Hierarchical (tree) view with COURSE as the root.

FIGURE 26.9 XML schema document with COURSE as the root.

FIGURE 26.10 Hierarchical (tree) view with STUDENT as the root.

FIGURE 26.11 XML schema document with STUDENT as the root.

FIGURE 26.12 Hierarchical (tree) view with SECTION as the root.

FIGURE 26.13 Converting a graph with cycles into a hierarchical (tree) structure.

XML Query XPath: Specifying Path Expressions in XML XQuery: Specifying Queries in XML

FIGURE 26.14 Some examples of XPath expressions on XML documents that follow the XML schema file COMPANY in Figure 26.5

FIGURE 26.15 Some examples of XQuery queries on XML documents that follow the XML schema file COMPANY in Figure 26.5.

Summary XML documents XML & databases