Presentation is loading. Please wait.

Presentation is loading. Please wait.

A technical introduction Felix Eickhoff XML Basics.

Similar presentations


Presentation on theme: "A technical introduction Felix Eickhoff XML Basics."— Presentation transcript:

1 A technical introduction Felix Eickhoff felix.eickhoff@gmx.net XML Basics

2 Overview Why XML Why XML XML Fundamentals XML Fundamentals Document Type Definitions Document Type Definitions XML Schemas XML Schemas Namespaces in XML Namespaces in XML XSL Transformations XSL Transformations XPath XPath XLinks XLinks XPointers XPointers

3 Why XML W3C endorsed standard W3C endorsed standard Generic syntax to mark up data Generic syntax to mark up data More flexible than HTML More flexible than HTML Need for sharing data Need for sharing data

4 XML Fundamentals XML Version, Doctype XML Version, Doctype Elements Elements  Start and End Tag  Attributes  Case sensitive  Contain other elements or data Comments Comments Well formedness Well formedness

5 XML Fundamentals - Example <address-book> Doe Doe 34 Fountain Square Plaza 34 Fountain Square Plaza 45202 45202 515-73737 515-73737 515-28378 515-28378 Jack Jack Phillip Phillip Smith Smith 737-378477 737-378477 </address-book>

6 XML Trees – Example

7 Document Type Definitions - DTD Defines language grammar for a particular XML application Defines language grammar for a particular XML application What for: What for:  Specific XML applications  Validation of XML-files

8 DTD - Example <!ELEMENT email href CDATA #REQUIRED preferred (true|false) „false“> preferred (true|false) „false“>

9 Document Type Defintions Element Declaration Element Declaration  #PCDATA, EMPTY, ANY Sequences Sequences  Using regular Expressions (*, +,| ) Attribute Declaration Attribute Declaration  CDATA, NMTOKEN, ENUMERATION, ENTITY, ID, IDREF, NOTATION, #REQUIRED, #IMPLIED, #FIXED Entities Entities  Internal and External

10 XML Schemas Alternative to DTD Alternative to DTD XML Syntax XML Syntax Data Typing Data Typing Content Models Content Models Extensible Extensible Dynamic Schemas Dynamic Schemas Self Documenting Self Documenting

11 XML - Example <?DOCTYPE address-book SYSTEM „address-book.xsd“<address-book> Doe Doe 34 Fountain Square Plaza 34 Fountain Square Plaza 45202 45202 515-73737 515-73737 515-28378 515-28378 Jack Jack Phillip Phillip Smith Smith 737-378477 737-378477 </address-book>

12 XML Schema - Example

13 XML Schema – Example (2)...

14 Namespaces in XML Distinguish between elements and attributes from different XML applications Distinguish between elements and attributes from different XML applications Group related elements and attributes together Group related elements and attributes together Based on unique Domain-Names Based on unique Domain-Names

15 Namespace - Example Memory of the Garden of Etten Vincent Van Gogh November, 1888 Two women...

16 Namespace – Example(2) Impressionists Paintings Joe Doe A list of famous impressionist paintings organized by painter and date 2001-10-05

17 Namespace – Example(3) Impressionists Paintings Joe Doe A list of famous impressionist paintings organized by painter and date 2001-10-05 Memory of the Garden of Etten Vincent Van Gogh November, 1888 Two women...

18 Namespace – Example(4) <rdf:Description xlmns:dc=„http://purl.org/dc“ about=„http://name.com/impressionists.html“> Impressionists Paintings Joe Doe A list of famous impressionist paintings organized by painter and date 2001-10-05 Memory of the Garden of Etten Vincent Van Gogh November, 1888 Two women...

19 XSL Transformations High-level language for defining XML Transformations High-level language for defining XML Transformations Format information for Display Format information for Display Useful for managing data exchange Useful for managing data exchange Report Writing Report Writing Work done by Stylesheet processors Work done by Stylesheet processors

20 Stylesheet – Example Input Alan Turing computer scientist mathematican cryptographer Richard M Feyman physicist Playing the bongoes

21 Stylesheet – Example <xsl:stylesheet version=„1.0“ xmlns:xsl=„http://www.w3.org/1999/XSL/Transform“> Famous Scientists

22 Stylesheet – Example (2) Born: Died:

23 Stylesheet – Example Output Famous Scientists Alan Turing Born: 1912 Died: 1954... </body

24 XSL – More features Uses XPath functions Uses XPath functions If-statements, For each loops If-statements, For each loops Parameters for templates Parameters for templates => Query language => Query language

25 XPath Identifies particular parts of XML documents Identifies particular parts of XML documents Navigate on the tree structures of XML documents like in a UNIX file system Navigate on the tree structures of XML documents like in a UNIX file system Many built-in functions Many built-in functions  e.g.:round, starts-with, substring,... Used by XSLT, XPointer Used by XSLT, XPointer

26 XPath – Example

27 XPath – Example (2)

28 XPath – Example (3) /people/person/name/first_name //last_name/../first_name

29 XLink Simple Links Simple Links  Like Links in HTML Extended Links Extended Links  More than one target possible  Directed labeled graph  Representation undecided yet Arcs Arcs  Links between other recources

30 XLink – Simple Link Example <novel xmlns:xlink=„http://www.w3.org/1999/xlink“ xlink:type=„simple“ xlink:href=„ftp://someserver.com/books/novels/wizoz.txt“ xlink:actuate=„onRequest“ xlink:show=„replace“ xlink:title=„A Link to the wonderful wizard...“ xlink:role=„http://moreinfo.com“> The wonderful wizard of oz Frank Baum

31 XLink – Extended Link Example <novel xmlns:xlink=„http://www.w3.org/1999/xlink“ xlink:type=„extended“> The wonderful wizard of oz Frank Baum <edition xlink:type=„locator“ xlink:href=„urn:isbn:123456“ xlink:title=„William Morrow“ xlink:role=„http://www.williammorrow.com/“ xlink:label=„ISBN123456“/> <edition xlink:type=„locator“ xlink:href=„urn:isbn:234567“ xlink:title=„Oxford University Press“ xlink:role=„http://www.oup-usa.org/“ xlink:label=„ISBN234567“/>

32 XLink – Arcs Example <series xlink:type=„extended“ xmlns:xlink=„http://www.w3.org/1999/xlink“> Frank Baum <novel xlink:type=„locator“ xlink:label=„oz1“ xlink:href=„ftp://someserver.com/wizoz.txt“> The wonderful wizard of oz <novel xlink:type=„locator“ xlink:label=„oz2“ xlink:href=„ftp://someserver.com/ozland.txt“> The marvelous land of oz <novel xlink:type=„locator“ xlink:label=„oz3“ xlink:href=„ftp://someserver.com/ooz.txt“> Ozma of oz

33 XLink – Arcs Example (2) The wonderful world of oz The marvelous land of oz Ozma of oz

34 XPointer Locates points in XML documents Locates points in XML documents Based on XPath Based on XPath In XLinks: http://www.someserver.com/xml/people.xml#xpointer (//name[position()=1]) xpointer(/) to the root xpointer(//first_name) Xpointer(//profession[.=„physicist“])

35 References XML in a Nutshell Elliotte Rusty Harold & W. Scott Means O‘Reilly XML in a Nutshell Elliotte Rusty Harold & W. Scott Means O‘Reilly Professional XML Databases Kevin Williams WROX Professional XML Databases Kevin Williams WROX http://xml.coverpages.org http://xml.coverpages.org


Download ppt "A technical introduction Felix Eickhoff XML Basics."

Similar presentations


Ads by Google