Download presentation
Presentation is loading. Please wait.
Published byIsabella Love Modified over 11 years ago
1
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 1 XML Extensible Markup Language
2
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 2 XML Metalanguage –A Language, which describes languages –Languages describe formats for data exchange
3
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 3 Example Hans Meyer Lohmannstrasse 23 06366 Köthen Dr. Else Müller Bernburger Strasse 56 06366 Köthen
4
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 4 Example Hans Meyer Lohmannstrasse 23 06366 Köthen Dr. Else Müller Bernburger Strasse 56 06366 Köthen
5
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 5 Structure of XML documents Prolog –Deklaration of type of dokument –DTD (Document Type Definition) Elements http://www.w3schools.com/xml/default.asp http://de.selfhtml.org/
6
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 6 Document Type Definition DTD It describes the grammar of a XML - document It describes permitted elements and attributes –their data type and range of values –their nesting An XML – Dokument, that conforms to a DTD is called valid
7
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 7 Example DTD <!DOCTYPE Personen [ ]> Hans Meyer Lohmannstrasse 23 06366 Köthen http://www.inf.hs-anhalt.de/~Worzyk/Telemedizin/Beispiele/Patienten1.xml
8
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 8 Structure of XML documents DTD describes the characteristics of the elements Elements are initiated by a start tag and are terminated by a closing tag. XML tags are case sensitive Elements can contain Elements. #PCDATA Parsed character data: The elements consist of character strings whose characters are part of the defined character set.
9
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 9 Names of Elements Names can contain letters, numbers, and other characters Names must not start with a number or punctuation character Names must not start with the letters xml (or XML or Xml..) Names cannot contain spaces
10
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 10 Sequence of Elements Subordinate elements are separated in the declaration by commas and included in parentheses. Example: <!DOCTYPE Personen [ ]> http://www.inf.hs-anhalt.de/~Worzyk/Telemedizin/Beispiele/Patienten2.xml http://www.inf.hs-anhalt.de/~Worzyk/Telemedizin/Beispiele/Patienten3.xml
11
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 11 selection list Selection of exactly one element: The available elements are seperated by | Example: <!DOCTYPE Personen [ http://www.inf.hs-anhalt.de/~Worzyk/Telemedizin/Beispiele/Patienten4.xml
12
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 12 Multiple occurrence * The element can appear no time or arbitrarily often + The element can appear at least one time or arbitrarily often ? The element can appear no time or at most one time
13
Datenbanksysteme 2 SS 2004 Seite 13 - 13 Worzyk FH Anhalt Attributes Types of attriutes:: CDATA, (en1|en2|..), ID, IDREF, IDREFS, NMTOKEN, NMTOKENS, ENTITY, ENTITIES, NOTATION, xml: Defaultvalue: value #REQUIRED, #IMPLIED, #FIXED value http://www.inf.hs-anhalt.de/~Worzyk/Telemedizin/Beispiele/Patienten5.xml http://www.w3schools.com/xml/xml_attributes.asp
14
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 14 Comments Comments are embedded by
15
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 15 Well-formed XML - File The file starts with the XML-declaration, which establish the reference to XML It exists at least one data element It exists exactly one root element, which contain all other data elements All required attributes are defined All elements have the right content The elements must be nested properly
16
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 16 Valide XML - File The file is well-formed A DTD is assigned to the file The content of the file is according to the assigned DTD
17
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 17 Parser A parser validates if an XML Document is valide: var xmlDoc = new ActiveXObject("Microsoft.XMLDOM") xmlDoc.async="false" xmlDoc.validateOnParse="true" xmlDoc.load("Patienten5.xml") document.write(" Error Code: ") document.write(xmlDoc.parseError.errorCode) document.write(" Error Reason: ") document.write(xmlDoc.parseError.reason) document.write(" Error Line: ") document.write(xmlDoc.parseError.line) http://www.inf.hs-anhalt.de/~Worzyk/Telemedizin/Beispiele/Parser.htm
18
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 18 DTD - Disadvantages Few datatypes specification not in XML – Syntax –Specification can not be validated with a parser
19
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 19 XML - Schema An XML Schema: defines elements that can appear in a document defines attributes that can appear in a document defines which elements are child elements defines the order of child elements defines the number of child elements defines whether an element is empty or can include text defines data types for elements and attributes defines default and fixed values for elements and attributes http://www.w3schools.com/schema/schema_intro.asp
20
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 20 XML Schema Advantages over DTD XML Schemas are extensible to future additions XML Schemas are richer and more useful than DTDs XML Schemas are written in XML XML Schemas support data types –xs;date, xs;dateTime, xs:string XML Schemas support namespaces –xmlns:xs="http://www.w3.org/2001/XMLSchema
21
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 21 Dublin Core Standard Dublin Core Metadata Initiative Conference in 1995 in Dublin / Ohio defined a set of describing attributs to categorize documents in the internet 15 core elements are recommended in Dublin Core Metadata Element Set, Version 1.1 (ISO 15836) http://dublincore.org/documents/dces/
22
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 22 How to create an XML structure Create a tree-structure of the data Convert that structure to a DTD Add data elements Test
23
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 23 Example Quarterly billing One file consists of exactly one physician and at least one patient A phyiscian is either a General Practitioner or a dentist A general practitioner has an address and a profession A dentist has an address A patient has an address and no ore more diagnisis An address consists of Name, City, Street A name has a salutation Mr. or Ms.
24
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 24 Example Quarterly billing billing PhysicianPatient General PractitionerDentistAddressDiagnosis Address Profession ? AdresseNameCityStreet MrMs + |*
25
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 25 Example - DTD <!DOCTYPE Billing [ ]>
26
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 26 Example - Data Dr. Erpel Entenhausen Am Krankenhaus 1 Geriatrics Daniel Entenhausen Bahnhofstrasse 3a Bettflucht Daisy Entenhausen Am Stadtpark Sonnenbrand Migräne
27
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 27 Queries to XML - Files XPath XQuery
28
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 28 XPath The language XPath serves to address parts of a XML document. It was designed for the use both in XSLT and in XPointer. XPath models a XML document as a tree, which consists of knots. http://www.informatik.hu-berlin.de/~obecker/obqo/w3c-trans/xpath-de-20010702/
29
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 29 Example Everyday Italian Giada De Laurentiis 2005 30.00 Harry Potter J K. Rowling 2005 29.99 XQuery Kick Start James McGovern Per Bothner Kurt Cagle James Linn Vaidyanathan Nagarajan 2003 49.99 Learning XML Erik T. Ray 2003 39.95
30
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 30 Queries with XPath Select all titles: /bookstore/book/title Select the title of the first book /bookstore/book[1]/title Select all the prices /bookstore/book/price/text() Select price nodes with price>35 /bookstore/book[price>35]/title http://www.w3schools.com/xpath/xpath_examples.asp
31
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 31 XQuery Querylanguage for XML data Uses Xpath expression Analogy to SQL
32
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 32 Xquery Example TCP/IP Illustrated Stevens W. Addison-Wesley 65.95 Advanced Programming in the Unix environment Stevens W. Addison-Wesley 65.95 Data on the Web Abiteboul Serge Buneman Peter Suciu Dan Morgan Kaufmann Publishers 39.95 The Technology and Content for Digital TV Gerbarg Darcy CITI Kluwer Academic Publishers 129.95
33
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 33 Xquery Example Query: doc("books.xml")/bib/book[price<50] results: Data on the Web Abiteboul Serge Buneman Peter Suciu Dan Morgan Kaufmann Publishers 39.95
34
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 34 FLWOR For, Let, Where, Order by, Return for $x in doc("books.xml")/bib/book where $x/price>50 order by $x/title return $x/title Results: Advanced Programming in the Unix environment TCP/IP Illustrated The Technology and Content for Digital TV
35
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 35 XML – Documents in Databases XML – Documents can be Focussed on data Focussed on text Semi-structured
36
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 36 Alternatives to store XML Documents Storage as a whole Storage within the XML-Structure Transformation to structures of the database
37
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 37 Storage of XML documents as a whole Original will be stored in a file system or as CLOB in a database full-text index Strukturindex
38
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 38 Example <hotel url=http://www.hotel-huebner.de id=h0001 erstellt-am=03/02/2003 Autor=Hans Müller> Hotel Hübner 4 18199 Warnemünde Seestraße 0381 / 5434-0 0381 / 5434-444 Aus Richtung Rostock kommend...
39
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 39 full-text index <hotel url=http://www.hotel-huebner.de id=h0001 erstellt-am=03/02/2003 Autor=Hans Müller> Hotel Hübner 4 18199 Warnemünde Seestraße 0381 / 5434-0 0381 / 5434-444 Aus Richtung Rostock kommend...
40
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 40 full-text - and Structurindex <hotel url=http://www.hotel-huebner.de id=h0001 erstellt-am=03/02/2003 Autor=Hans Müller> Hotel Hübner 4 18199 Warnemünde Seestraße 0381 / 5434-0 0381 / 5434-444 Aus Richtung Rostock kommend...
41
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 41 Queries Volltextindex hotel AND warnemünde (hotel OR pension) AND (rostock OR warnemünde) Volletxt- und Strukturindex hotel.adresse.ort CONTAINS (warnemünde) AND hotel.freizeitmoeglichkeit CONTAINS (swimming pool)
42
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 42 Characteristics full-text index
43
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 43 generic storage Storage within the XML- Structure All Informationen of the XML-Dokument will be stored –simple generic Storage –Document Object Model
44
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 44 Beispiel
45
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 45 Document Object Model The structure of the tree will be transformed to a class hierarchy Storage in objectrelational or objektoriented databases
46
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 46 Queries XPath QXuery XQL –Abfragesprache der Software AG SQL
47
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 47 Characteristics Generic Storage
48
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 48 Transformation to Structures of databases DTD or Schema must be available Automatic or userdriven procedures Transformtion to relational objectrelational objectoriented Databases
49
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 49 Transformation
50
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 50 Example
51
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 51 Queries SQL with –Joins –Aggregatfunktionen –Queryoptimizing –Update
52
Worzyk FH Anhalt Telemedizin WS 09/10 XML - 52 Characteristics Structures of databases
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.