Part 2: XML and Data Management Chapter 6: Overview of XML

Similar documents
CountryData Technologies for Data Exchange. Introduction to XML

Copyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 27-1

EXAM IN SEMI-STRUCTURED DATA Study Code Student Id Family Name First Name

Week 2: Lecture Notes. DTDs and XML Schemas

XML DTDs and Namespaces. CS174 Chris Pollett Oct 3, 2007.

XML. COSC Dr. Ramon Lawrence. An attribute is a name-value pair declared inside an element. Comments. Page 3. COSC Dr.

EMERGING TECHNOLOGIES. XML Documents and Schemas for XML documents

HTML vs. XML In the case of HTML, browsers have been taught how to ignore invalid HTML such as the <mymadeuptag> element and generally do their best

XML. Rodrigo García Carmona Universidad San Pablo-CEU Escuela Politécnica Superior

Querying XML Data. Querying XML has two components. Selecting data. Construct output, or transform data

Introduction Syntax and Usage XML Databases Java Tutorial XML. November 5, 2008 XML

XML: Extensible Markup Language

Data Presentation and Markup Languages

XML. XML Namespaces, XML Schema, XSLT

XML - Schema. Mario Arrigoni Neri

Chapter 3 Brief Overview of XML

Chapter 13 XML: Extensible Markup Language

Session [2] Information Modeling with XSD and DTD

7.1 Introduction. extensible Markup Language Developed from SGML A meta-markup language Deficiencies of HTML and SGML

Delivery Options: Attend face-to-face in the classroom or remote-live attendance.

More XML Schemas, XSLT, Intro to PHP. CS174 Chris Pollett Oct 15, 2007.

COMP9321 Web Application Engineering. Extensible Markup Language (XML)

Knowledge Engineering pt. School of Industrial and Information Engineering. Test 2 24 th July Part II. Family name.

Author: Irena Holubová Lecturer: Martin Svoboda

XML: Introduction. !important Declaration... 9:11 #FIXED... 7:5 #IMPLIED... 7:5 #REQUIRED... Directive... 9:11

- XML. - DTDs - XML Schema - XSLT. Web Services. - Well-formedness is a REQUIRED check on XML documents

The concept of DTD. DTD(Document Type Definition) Why we need DTD

Delivery Options: Attend face-to-face in the classroom or via remote-live attendance.

Introduction to XML. XML: basic elements

XML Applications. Prof. Andrea Omicini DEIS, Ingegneria Due Alma Mater Studiorum, Università di Bologna a Cesena

XML. extensible Markup Language. ... and its usefulness for linguists

7.1 Introduction. 7.1 Introduction (continued) - Problem with using SGML: - SGML is a meta-markup language

SDPL : XML Basics 2. SDPL : XML Basics 1. SDPL : XML Basics 4. SDPL : XML Basics 3. SDPL : XML Basics 5

COMP9321 Web Application Engineering

XML databases. Jan Chomicki. University at Buffalo. Jan Chomicki (University at Buffalo) XML databases 1 / 9

Introduction. " Documents have tags giving extra information about sections of the document

Chapter 1: Getting Started. You will learn:

Introduction. " Documents have tags giving extra information about sections of the document

Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 7 XML

Module 3. XML Schema

Introduction to Semistructured Data and XML. Overview. How the Web is Today. Based on slides by Dan Suciu University of Washington

EXAM IN SEMI-STRUCTURED DATA Study Code Student Id Family Name First Name

Dr. Awad Khalil. Computer Science & Engineering department

PASS4TEST. IT Certification Guaranteed, The Easy Way! We offer free update service for one year

IBM. XML and Related Technologies Dumps Braindumps Real Questions Practice Test dumps free

CS/INFO 330: Applied Database Systems

XML. Objectives. Duration. Audience. Pre-Requisites

XML (4) Extensible Markup Language

DTD MIGRATION TO W3C SCHEMA

XML Origin and Usages

EXAM IN SEMI-STRUCTURED DATA Study Code Student Id Family Name First Name

Information Systems. DTD and XML Schema. Nikolaj Popov

XML Schema Profile Definition

Chapter 1: Semistructured Data Management XML

UNIT 3 XML DATABASES

XML Extensible Markup Language

M359 Block5 - Lecture12 Eng/ Waleed Omar

EXAM IN SEMI-STRUCTURED DATA Study Code Student Id Family Name First Name

Querying XML. COSC 304 Introduction to Database Systems. XML Querying. Example DTD. Example XML Document. Path Descriptions in XPath

!" DTDs rely on a mechanism based on the use of. !" It is intended to specify cross references" !" Reference to a figure, chapter, section, etc.!

Chapter 1: Semistructured Data Management XML

Overview. Introduction to XML Schemas. Tutorial XML Europe , Berlin. 1 Introduction. 2 Concepts. 3 Schema Languages.

~ Ian Hunneybell: DIA Revision Notes ~

XML in Databases. Albrecht Schmidt. al. Albrecht Schmidt, Aalborg University 1

Introduction to XML DTD

CSI 3140 WWW Structures, Techniques and Standards. Representing Web Data: XML

CHAPTER 8. XML Schemas

Introduction to XML. An Example XML Document. The following is a very simple XML document.

A namespace prefix is defined with a xmlns attribute using the syntax xmlns:prefix="uri".

XML and Content Management

DBMaker. XML Tool User's Guide

Contents. 1 Introduction Basic XML concepts Historical perspectives Query languages Contents... 2

Introduction to XML (Extensible Markup Language)

The main problem of DTD s...

.. Cal Poly CPE/CSC 366: Database Modeling, Design and Implementation Alexander Dekhtyar..

Structured documents

Java EE 7: Back-end Server Application Development 4-2

CS561 Spring Mixed Content

EXAM IN SEMI-STRUCTURED DATA Study Code Student Id Family Name First Name

(One) Layer Model of the Semantic Web. Semantic Web - XML XML. Extensible Markup Language. Prof. Dr. Steffen Staab Dipl.-Inf. Med.

Semistructured Data and XML

Introduction to XML. M2 MIA, Grenoble Université. François Faure

Sticky and Proximity XML Schema Files

COMP9321 Web Application Engineering

Introduction to XML. Chapter 133

CA Data Protection. Account Import XML Schema Guide. Release 15.0

CSS, Cascading Style Sheets

XML. Semi-structured data (SSD) SSD Graphs. SSD Examples. Schemas for SSD. More flexible data model than the relational model.

XML. extensible Markup Language. Overview. Overview. Overview XML Components Document Type Definition (DTD) Attributes and Tags An XML schema

Introduction to XML Zdeněk Žabokrtský, Rudolf Rosa

What is XML? XML is designed to transport and store data.

Web Services. Richard Sinnott.

Outline. XML vs. HTML and Well Formed vs. Valid. XML Overview. CSC309 Tutorial --XML 4. Edward Xia

XML: and related technologies

XML: Managing with the Java Platform

CSCI3030U Database Models

XML, DTD: Exercises. A7B36XML, AD7B36XML: XML Technologies. Practical Classes 1 and 2: 3. and

Part II: Semistructured Data

Introduction to Data Management CSE 344

Question Bank XML (Solved/Unsolved) Q.1 Fill in the Blanks: (1 Mark each)

Transcription:

Part 2: XML and Data Management Chapter 6: Overview of XML Prof. Dr. Stefan Böttcher 6. Overview of the XML standards: XML, DTD, XML Schema 7. Navigation in XML documents: XML axes, DOM, SAX, XPath, Tree Pattern queries Further topics: XML streaming, compression

Data centric XML - XML data storage <doc> <order> start tag <customer> Alice </customer> <PC> pc400 </PC> </order> <order> <customer> Bob </customer> <PC> pc500 </PC> </order> <order> <customer> Carla </customer> <PC> pc600 </PC> </order> </doc> end tag doc % customer PC order( Alice pc400 ). order( Bob pc500 ). order( Carla pc600 ). 2/25

extended Markup Language (XML) XML - a family of standards: XML (extensible Markup Language) exchangable data format across different operating systems, applications, and enterprises often used for content XPath path expressions used for navigation in XML trees used within other XML standards (e.g. XSL(T)) XSL (extensible Stylesheet Language) used to describe layout of content / to convert data many more standards: XQuery ( queries ), DTD ( type definitions ), XML-Schema ( integrity constraints ) 3/25

Separation of content and layout content (product2.xml) layout ( technican2.xsl) content (product1.xml) layout (customer1.xsl) HTML file combines requested data with requested layout 4/25

Separation of content and layout (2) consequences: 1 (content) data source for different layouts (technican, seller, customer, re-seller,...) layout may change without changing the content ( different logo, different seller or customer, different employee or job, new view of data ) reuse 1 layout for different content ( frame with company logo,...) content may change without changing layout ( new prices, ) 5/25

XML on Java servers XML + XSL layout (.xsl file) content data (.xml file) separate layout and content combine them in the web server XML file XSL file HTMLpage input browser client calls generated HTML page servlet server transform XML+XSL HTML 6/25

XML document as a data storage <doc> <order> opening tag <customer> Alice </customer> <PC> pc400 </PC> </order> <order> <customer> Bob </customer> <PC> pc500 </PC> </order> <order> <customer> Carla </customer> <PC> pc600 </PC> </order> </doc> closing tag doc % customer PC order( Alice pc400 ). order( Bob pc500 ). order( Carla pc600 ). 7/25

XML syntax XML - Prolog: version character set without DTD! <?xml version="1.0" encoding="iso-8859-1" standalone="yes"?> <?xml-stylesheet type="text/xsl" href="xmlbsp1.xsl"?> XML - main part: used stylesheet (only inside ie5) element start tag /end tag <order> <customer> Alice </customer> <PC> pc400 </PC> </order> text node 8/25

XML syntax (2) In the XML main part: (arbitrarily) no text node <offers> <offer supplier= vobis item= pc500 > </offer> attribute attribute value end of tag (no text) <offer supplier= IBM item= pc600 / > </offers> element 9/25

XML syntax (3) all tags must be closed (<tag>... </tag> or <singletag />) incorrectly nested tags not allowed ( <tag1> <tag2>... </tag1> </tag2> ) case-sensitive ( <tag> different from <Tag> ) attribute values must be quoted ( e.g. <p align="center"> ) text must be enclosed in elements 10/25

XML document as a tree <doc> <customer name= Alice > <order>... </order> <address> </address> </customer> <customer> <order/> <address/> </customer> </doc> name = Alice customer doc customer order address order address 11/25

XML node types 7 kinds of nodes: root - has no parent node element text attribute - leaf node (has no child node) - leaf node (has no child node) comment - leaf node (has no child node) name-space - leaf node (has no child node) processing-instruction - leaf node (has no child node) 12/25

Node type definitions: Common aspects DTD or XML Schema or Relax NG: defines structure of all XML trees exchanged => unique data format for all participants data formats exchangeable across company borders New data exchange formats and languages based on XML example: ebxml (E-Business XML) as a basis for OTA (Open Travel Association) data exchange between travel agency, airline etc. Consequence of these standards: ( economic ) force to use the standard 13/25

Differences between DTD and XML Schema DTD ( the older standard ) : + defines the structure (nesting of tags) of the documents <customer> <order> <item> + defines structural dependencies, e.g. every order contains at least one item element XML-Schema ( the newer standard ) additionally : + binds XML elements to types defined in the XML Schema + defines domains + defines integrity constraints 14/25

Document-Type-Definition (DTD) <!-- DTD xmlbsp2d.dtd for example xmlbsp2d.mxl --> <!ELEMENT orders ( order )* > <!ELEMENT order ( customer, PC ) > <!ELEMENT customer (#PCDATA) > <!ELEMENT PC (#PCDATA) > arbitrary many root element parsed char data sequence required <?xml version="1.0" encoding="iso-8859-1" standalone="no"?> <!DOCTYPE orders SYSTEM "xmlbsp2d.dtd"> <?xml-stylesheet type="text/xsl" href="xmlbsp2.xsl"?> <orders> <order> <customer> Alice </customer> <PC> pc400 </PC> </order> <order>... </order> </orders> 15/25

Element declarations in DTDs <!ELEMENT PC (#PCDATA) > <!ELEMENT offer (EMPTY) > <!ELEMENT supplies (offer) > <!ELEMENT offers (offer)* > <!ELEMENT order (customer,pc) > <!ELEMENT payment (cash card) > <!ELEMENT E ((A B)*,C,(D)?)+ > text (no elements) empty 1 sub-element? 0 or 1 * arbitrary many + al least 1 sub-element sequence choice paranthesis 16/25

Attribute declarations in DTDs <!-- DTD xmlbsp2d.dtd for the example xmlbsp2d.xml --> <!ELEMENT offers (offer)* > arbitrary many <!ELEMENT offer (EMPTY) > empty <!ATTLIST offer supplier CDATA #REQUIRED item CDATA #REQUIRED > root element attribute type (char data) must occur <offers> <offer supplier= vobis item= pc500 > </offer> <offer supplier= IBM item= pc600 / > </offers> 17/25

XML Schema Beyond DTDs: distinguish between element name and element type ( e.g. street and firstname being of type xsd:string ) domain restriction ( e.g. plz being a 5 digit xsd:integer ) sub-typing by domain restriction type extension (e.g. additional children or attributes) structural constraints ( e.g. MinOccurs=5 MaxOccurs=7 ) 18/25

XML Schema - simple data types Basic types: xsd:string xsd:decimal xsd: integer xsd: float xsd:boolean xsd:date xsd:time QName ( qualified name ) anyuri language (e.g. de-de, en-us, ) ID IDREF 19/25

XML Schema - list and union data types <xsd:simpletype name="intday"> <xsd:restriction base="xsd:integer"> <xsd:mininclusive value="1"/> <xsd:maxinclusive value="7"/> </xsd:restriction> </xsd:simpletype> data type definitions <xsd:simpletype name="days"> <xsd:list itemtype="intday"/> </xsd:simpletype> <days> 1 2 3 4 5 </days> instance of type days 20/25

fullname followed by either street or POB XML Schema example (1) <xsd:element name="address" > <xsd:sequence> <xsd:element name="fullname" maxoccurs="1"> <xsd:sequence> <xsd:element name="firstname" type="xsd:string"/> <xsd:element name="lastname "type="xsd:string"/> </xsd:sequence> </xsd:element> <xsd:choice> <xsd:element name="street" type="xsd:string"/> <xsd:element name="pob" type="xsd:integer"/> </xsd:choice> </xsd:sequence> </xsd:element> nested elements both in this order either street or POB 21/25

XML Schema example (2) <xsd:element name="shipto" type="coaddress"/> <xsd:complextype name="address"> <xsd:complexcontent> <xsd:sequence> <xsd:element name="fullname"/> <xsd:element name="street"/> </xsd:sequence> </xsd:complexcontent> </xsd:complextype> element of extended type nested elements of complex type Address <xsd:complextype name="coaddress"> <xsd:extension base="address"> <xsd:sequence> <xsd:element name="countrycode"/> </xsd:sequence> </xsd:extension> </xsd:complextype> </xsd:element> extension of complex type Address additional element 22/25

ID and IDREF <person pnr= 12345 > <in pid= p1 /> <in pid= p2 /> </person> <project p_id= p1 > <with persid= 12345 /> <with persid= 6789 /> </project> <project p_id= p2 > <with persid= 12345 /> </project> unique <!-- DTD for element person --> <!ELEMENT person (in)* > <!ATTLIST person pnr PCDATA ID #REQUIRED> <!ELEMENT with (EMPTY) > <!ATTLIST with pid PCDATA IDREF #REQUIRED> <!-- DTD for element project --> <!ELEMENT project (with)* > <!ATTLIST project p_id PCDATA ID #REQUIRED> <!ELEMENT with (EMPTY) > <!ATTLIST with persid PCDATA IDREF #REQUIRED > no type checking error prone 23/25

ID and IDREFS <person pnr= 12345 pids= p1 p2 /> <!-- DTD for element person --> <!ELEMENT person (EMPTY) > <!ATTLIST person pnr PCDATA ID #REQUIRED pids PCDATA IDREFS #REQUIRED > <project p_id= p1 persids= 12345 6789 /> <project p_id= p2 persids= 12345 /> <!-- DTD for element project --> <!ELEMENT project (EMPTY) > <!ATTLIST project p_id PCDATA ID #REQUIRED persids PCDATA IDREFS #REQUIRED > 24/25

XML - summary XML : DTD : XML-Schema tree structure for content structure definition additionally: type checking and logical consistency checking well documented standards http://www.w3c.org 25/25