Internet Technology 1 Presentation 10: XML technologies.

Slides:



Advertisements
Similar presentations
XML-XSL Introduction SHIJU RAJAN SHIJU RAJAN Outline Brief Overview Brief Overview What is XML? What is XML? Well Formed XML Well Formed XML Tag Name.
Advertisements

Chungnam National University DataBase System Lab
1 eXtensible Markup Language. XML is based on SGML: Standard Generalized Markup Language HTML and XML are both based on SGML 2 SGML HTMLXML.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Introduction to XHTML Programming the World Wide Web Fourth edition.
1
1 Roger L. Costello 16 June 2010 XQuery
Copyright © 2003 Pearson Education, Inc. Slide 7-1 Created by Cheryl M. Hughes, Harvard University Extension School Cambridge, MA The Web Wizards Guide.
Copyright © 2003 Pearson Education, Inc. Slide 8-1 Created by Cheryl M. Hughes, Harvard University Extension School Cambridge, MA The Web Wizards Guide.
Copyright © 2003 Pearson Education, Inc. Slide 3-1 Created by Cheryl M. Hughes The Web Wizards Guide to XML by Cheryl M. Hughes.
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Copyright © 2003 Pearson Education, Inc. Slide 6-1 Created by Cheryl M. Hughes, Harvard University Extension School Cambridge, MA The Web Wizards Guide.
Copyright © 2003 Pearson Education, Inc. Slide 7-1 Created by Cheryl M. Hughes The Web Wizards Guide to XML by Cheryl M. Hughes.
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 6 Author: Julia Richards and R. Scott Hawley.
Author: Julia Richards and R. Scott Hawley
Properties Use, share, or modify this drill on mathematic properties. There is too much material for a single class, so you’ll have to select for your.
Slide 1 FastFacts Feature Presentation August 28, 2008 We are using audio during this session, so please dial in to our conference line… Phone number:
RXQ Customer Enrollment Using a Registration Agent (RA) Process Flow Diagram (Move-In) Customer Supplier Customer authorizes Enrollment ( )
8 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: JavaServer Pages.
Introduction to HTML, XHTML, and CSS
Custom Statutory Programs Chapter 3. Customary Statutory Programs and Titles 3-2 Objectives Add Local Statutory Programs Create Customer Application For.
22-Sep-06 CS6795 Semantic Web Techniques 0 Extensible Markup Language.
4. Internet Programming ENG224 INFORMATION TECHNOLOGY – Part I
Web Service Testing RESTful Web Services Snejina Lazarova Dimo Mitev
Bright Futures Guidelines Priorities and Screening Tables
1 Tables and Lists. 2 Are Tables still needed? Tables were once used to help structure and style our pages CSS now replaces most of the old uses for tables.
EIS Bridge Tool and Staging Tables September 1, 2009 Instructor: Way Poteat Slide: 1.
XML and Databases Exercise Session 3 (courtesy of Ghislain Fourny/ETH)
Benchmark Series Microsoft Excel 2013 Level 2
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
1..
31242/32549 Advanced Internet Programming Advanced Java Programming
CONTROL VISION Set-up. Step 1 Step 2 Step 3 Step 5 Step 4.
© 2012 National Heart Foundation of Australia. Slide 2.
XML INTRODUCTION Prepared by Hongming Yu Modified by Fernando Farfán.
XML Craig Stewart Dr. Alexandra I. Cristea
Dr. Alexandra I. Cristea XHTML.
2004 EBSCO Publishing Presentation on EBSCOadmin.
Presentation 7 part 2: SOAP & WSDL.
To the Assignments – Work in Progress Online Training Course
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Chapter 12 Working with Forms Principles of Web Design, 4 th Edition.
Essential Cell Biology
PSSA Preparation.
Essential Cell Biology
Presentation 3: Basic HTML & XHTML Fundamentals of Web-Centric Development.
Chapter 13 Web Page Design Studio
Energy Generation in Mitochondria and Chlorplasts
RefWorks: The Basics October 12, What is RefWorks? A personal bibliographic software manager –Manages citations –Creates bibliogaphies Accessible.
Introducing theW3C : Table of Contents 1. What is the W3C 2. The Origin of the W3C 3. The Scope of the W3C 4. W3C Services 5. W3C and XML 6. W3C Documents.
Steffen Staab 1WeST Web Science & Technologies University of Koblenz ▪ Landau, Germany Structured Data on the Web Introduction to.
Introduction Peter Dolog dolog [at] cs [dot] aau [dot] dk Intelligent Web and Information Systems September 9, 2010.
South Dakota Library Network MetaLib User Interface South Dakota Library Network 1200 University, Unit 9672 Spearfish, SD © South Dakota.
Presentation 6: Introduction to XML and related technologies – for use with SOAP / WSDL = Web services.
1 Extensible Markup Language: XML HTML: portable, widely supported protocol for describing how to format data XML: portable, widely supported protocol.
Presentation 6: Introduction to XML and related technologies.
XML – Extensible Markup Language Sivakumar Kuttuva & Janusz Zalewski.
 2001 Deitel & Associates, Inc. All rights reserved. 1 Chapter 27 – XML (Extensible Markup Language) Outline 27.1Introduction 27.2Structuring Data 27.3Document.
XML What is XML? XML v.s. HTML XML Components Well-formed and Valid Document Type Definition (DTD) Extensible Style Language (XSL) SAX and DOM.
1 © Netskills Quality Internet Training, University of Newcastle Introducing XML © Netskills, Quality Internet Training University.
XML 1 Enterprise Applications CE00465-M XML. 2 Enterprise Applications CE00465-M XML Overview Extensible Mark-up Language (XML) is a meta-language that.
CSCI/CMPE 4341 Topic: Programming in Python Chapter 9: Python XML Processing Xiang Lian The University of Texas – Pan American Edinburg, TX 78539
Intro. to XML & XML DB Bun Yue Professor, CS/CIS UHCL.
XML Extensible Markup Language
Introduction to XML This presentation covers introductory features of XML. What XML is and what it is not? What does it do? Put different related technologies.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 1COMP9321, 15s2, Week.
When we create.rtf document apart from saving the actual info the tool saves additional info like start of a paragraph, bold, size of the font.. Etc. This.
Presentation 6: Introduction to XML and related technologies – for use with SOAP / WSDL = Web services.
CIS 228 The Internet 9/20/11 XHTML 1.0. “Quirks” Mode Today, all browsers support standards Compliant pages are displayed similarly There are multiple.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
Unit 4 Representing Web Data: XML
Presentation transcript:

Internet Technology 1 Presentation 10: XML technologies

Ingeniørhøjskolen i Århus Slide 2 af 34 Outline W3C & heritage of XML XML Markup & Namespaces DTD’s XML Schemas DOM/SAX

Ingeniørhøjskolen i Århus Slide 3 af 34 W3C & the legacy of XML World Wide Consortium –Founded 1994 to lead the WWW into the future –For standardizations on the Internet –First Chairman: Sir Tim Berners-Lee –Run by Chairman, Director & Staff –Boards of members submits proposals and work to formulate –Ensures standardization of WWW technologies Like: XHTML, XML, XSL, CSS, SOAP, WAP etc. Members: Microsoft, IBM, SUN, Oracle –

Ingeniørhøjskolen i Århus Slide 4 af 34 SGML Standard Generalized Markup Language (ISO 8879:1986 SGML)ISO ISO-standard technology for defining generalized markup languages for documentsISOmarkup languages Original SGML, which was accepted in October 1986 Based on Generalized Markup Language (GML) GML was developed in the 1960s by Charles Goldfarb, Edward Mosher and Raymond LorieCharles GoldfarbEdward Mosher Raymond Lorie This is a front-of-screen photograph from a 3279 mainframe-attached screenmainframe LEXX Editor for the OED (1985/1986), sample entry (segment of) This is a front-of-screen photograph from a 3279 mainframe-attached screenmainframe LEXX Editor for the OED (1985/1986), sample entry (segment of)

Ingeniørhøjskolen i Århus Slide 5 af 34 XML markup eXtended Markup Language XML based on SGML (subset of) Like SGML for structure not layout (as HTML) XML targets the Internet – but is also being used for application exchange formats (Open Office, XMI) – CSVs XML is an W3C Recommendation – Structure decided by DTD or Schema (more later) Wide spread support for XML (hype)

Ingeniørhøjskolen i Århus Slide 6 af 34 Examples of XML usage GUI for “thin” clients –XHTML –WML (we shall look closer at this shortly) Inter-process communication –SOAP –BizTalk –ebXML Databases –XML Databases –XQuery –XLink, XPointer Representation / exchange of data –XMI (UML diagrams exchange format) –MathXML –CML –Proprietary Example: EPJ XML –good thing when every danish county makes its own Easy to comprehend due to the nature of XML Open office

Ingeniørhøjskolen i Århus Slide 7 af 34 Presenting XML documents Examples fetched from DEITEL First we will look at a standalone XML document and its components (elements) –Note: XML document needs to be Well formed (must be syntactically correct) Please go to to see more in-depth examples of XML usage

Ingeniørhøjskolen i Århus Slide 8 af 38 Article.xml Simple XML 9 10 September 19, Tem 14 Nieto XML is pretty easy Once you have mastered XHTML, XML is easily 20 learned. You must remember that XML is not for 21 displaying information but for managing information Element article is the root element. Elements title, date, author, summary and content are child elements of article. Element author is a “container element” contains Childs, firstName and lastName

Ingeniørhøjskolen i Århus Slide 9 af 34 Browser displaying XML (unformatted) IE5.5 displaying article.xml.

Ingeniørhøjskolen i Århus Slide 10 af 34 Small “stop up” exercise 1 We will do some small common exercises. Use 5 min. to this exercise: Setup a XML document, containing data about your merits at IHA and other institutions –Incl. “group of subjects” to which you have participated and your possible trainee period –The courses might have a name, a code, a type, a course holder, type of assessment, and other topics you find of relevance. Start with 2-3 courses –Your course gradings how do they relate to the courses and what are they?

Ingeniørhøjskolen i Århus Slide 11 af 34 Use of XML Namespaces XML namespaces used to avoid naming conflicts When several different elements are involved isn't always a book Keyword ”xmlns” Remember xmlns is nothing more than organizing names in spaces.

Ingeniørhøjskolen i Århus Slide 12 af 38 Namespace.xml <text:directory xmlns:text = "urn:deitel:textInfo" 7 xmlns:image = "urn:deitel:imageInfo"> A book list A funny picture Keyword xmlns creates two namespace prefixes, text and image. URIs (Uniform Resource Identifiers) ensure that a namespace is unique. Attribute

Ingeniørhøjskolen i Århus Slide 13 af 38 Defaultnamespace.xml <directory xmlns = "urn:deitel:textInfo" 7 xmlns:image = "urn:deitel:imageInfo"> A book list A funny picture Default namespace. Element file uses the default namespace. Element file uses the namespace prefix image.

Ingeniørhøjskolen i Århus Slide 14 af 38 Stop up exercise 2 Use Namespace(s) in your XML document (from s.u. exc. 1)

Ingeniørhøjskolen i Århus Slide 15 af 38 DTDs Document Type Definition Extended Backus-Naur Form Defines how an XML document is structured –Required elements –Nesting of elements –Does not define types or behaviour If DTD is used – some parsers can decide if XML document is “valid” – which is more than just “well formed”

Ingeniørhøjskolen i Århus Slide 16 af 38 Letter.dtd <!ELEMENT letter ( contact+, salutation, paragraph+, 5 closing, signature )> 6 7 <!ELEMENT contact ( name, address1, address2, city, state, 8 zip, phone, flag )> The ELEMENT element type declaration defines the rules for element letter. The plus sign ( + ) occurrence indicator specifies that the DTD allows one or more occurrences of an element. (2 contacs in our example) The contact element definition specifies that element contact contains child elements name, address1, address2, city, state, zip, phone and flag — in that order. #CDATA Unparsed character #PCDATA Parsed character

Ingeniørhøjskolen i Århus Slide 17 af 38 Letter.dtd <!ELEMENT letter ( contact+, salutation, paragraph+, 5 closing, signature )> 6 7 <!ELEMENT contact ( name, address1, address2, city, state, 8 zip, phone, flag )> The ATTLIST element type declaration defines an attribute (i.e., type ) for the contact element. Keyword #IMPLIED specifies that if the parser finds a contact element without a type attribute, the parser can choose an arbitrary value for the attribute or ignore the attribute and the document will be valid. Flag #PCDATA specifies that the element can contain parsed character data (i.e., text). See letter.xml next page

Ingeniørhøjskolen i Århus Slide 18 af 38 Letter.xml John Doe Main St Anytown 15 Anystate Joe Schmoe 23 Box Any Ave. 25 Othertown 26 Otherstate

Ingeniørhøjskolen i Århus Slide 19 af 38 Letter.xml Program Output 32 Dear Sir: It is our privilege to inform you about our new 35 database managed with XML. This new system allows 36 you to reduce the load of your inventory list server by 37 having the client machine perform the work of sorting 38 and filtering the data. 39 Sincerely 40 Mr. Doe

Ingeniørhøjskolen i Århus Slide 20 af 38 Program Output Or from

Ingeniørhøjskolen i Århus Slide 21 af 38 Stop up exercise 3 Take 5 minutes: Setup a DTD, that confirms to your xml document educations.xml and extend the xml document with DTD information

Ingeniørhøjskolen i Århus Slide 22 af 38 XML Schema DTD works OK – but –Is in Ex. Backus-Naur Form – why not use XML to describe? –Cannot declare a type to of an element – hundrede kr Could give problems –Several other problems W3C XML Schema –Use XML to describe the structure of XML documents … –Possible to give type information to XML definitions Not supported by all parsers yet Will live besides DTDs for a while

Ingeniørhøjskolen i Århus Slide 23 af 38 Book.xsd <xsd:schema xmlns:xsd = " 7 xmlns:deitel = " 8 targetNamespace = " <xsd:element name = "book" type = "deitel:BookType" 14 minOccurs = "1" maxOccurs = "unbounded"/> Namespace prefix. Element element defines an element to be included in the XML document structure. Attributes name and type specify the element ’s name and data type, respectively. Element complexType defines an element type that has a child element named book. Attribute minOccurs specifies that books must contain a minimum of one book element. The resulting namespace.

Ingeniørhøjskolen i Århus Slide 24 af 38 Book.xsd <xsd:schema xmlns:xsd = " 7 xmlns:deitel = " 8 targetNamespace = " <xsd:element name = "book" type = "deitel:BookType" 14 minOccurs = "1" maxOccurs = "unbounded"/> A BookType has an Element named Title of Type “xsd:string” – which is defined at “

Ingeniørhøjskolen i Århus Slide 25 af 38

Ingeniørhøjskolen i Århus Slide 26 af 38 Stop up exercise 4 Take a 5 minutes discussion to your neighbor about how to replace the DTD with a Schema

Ingeniørhøjskolen i Århus Slide 27 af 38 How to use XML? Need a parser (or a parser API) to access XML (as with CSV) Two commonly used methods: –DOM (Document Object Model) W3C Recommendation Makes a tree structure representation of an XML document in memory –SAX (Simple API for XML) Supported by diff. vendors Parses document line by line and sends events to subscribers Needs to parse every time access to XML document is needed DOM is better for –Slow to load XML document (need all) –Quick access to random read or update of XML (like WWW browser - BOM) –Requires a lot of memory (need to hold entire XML in mem) SAX is better for –Applications subscribing to certain parts of XML (event subscription) –Slow for random access to XML document (must parse every time) Think at a XML documents as a kind of persistent data (“a database”)

Ingeniørhøjskolen i Århus Slide 28 af 38 What is DOM DOM: Document Object Model – / / W3C definition: –Standard for accessing structured documents –Core DOM used with XML –HTML DOM used with HTML –Representation of an object as an object tree structure –Provides a uniform interface for programming and scripting languages –API’s available for JavaScript, Java, C++, C# etc.

Ingeniørhøjskolen i Århus Slide 29 af 38 DOM Tree Structure Tree structure of an XML document (left) … or HTML (right) document …table tbody … …… tr td tekst tekst ….

Ingeniørhøjskolen i Århus Slide 30 af 38 Example – using DOM on Article.xml We have looked at Article.xml We Will: –Look at the Article.xml document again –Look at the Tree Structure formed by loading it into a DOM –Use JavaScript to work on it

Ingeniørhøjskolen i Århus Slide 31 af Simple XML 9 10 September 19, Tem 14 Nieto XML is pretty easy Once you have mastered XHTML, XML is easily 20 learned. You must remember that XML is not for 21 displaying information but for managing information XML document – Article.XML

Ingeniørhøjskolen i Århus Slide 32 af 38 DOM Methods firstName lastName contents summary author date title article Tree structure for article.xml.

Ingeniørhøjskolen i Århus Slide 33 af 38 DOMExample.ht ml 1 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 3 " A DOM Example <!-- 17 var xmlDocument = new ActiveXObject( "Microsoft.XMLDOM" ); xmlDocument.load( "article.xml" ); // get the root element 22 var element = xmlDocument.documentElement; document.writeln( 25 " Here is the root node of the document: " + 26 " " + element.nodeName + " " + 27 " The following are its child elements:" + 28 " " ); // traverse all child nodes of root element 31 for ( var i = 0; i < element.childNodes.length; i++ ) { 32 var curNode = element.childNodes.item( i ); 33 Instantiate a Microsoft XML Document Object Model object and assign it to reference xmlDocument. method load loads article.xml (Fig. 20.1) into memory.Property documentElement corresponds to the root element in the document (e.g., article ). Iterates through the root node’s children using property childNodes.

Ingeniørhøjskolen i Århus Slide 34 af 38 DOMExample.html 34 // print node name of each child element 35 document.writeln( " " + curNode.nodeName 36 + " " ); 37 } document.writeln( " " ); // get the first child node of root element 42 var currentNode = element.firstChild; document.writeln( " The first child of root node is: " + 45 " " + currentNode.nodeName + " " + 46 " whose next sibling is:" ); // get the next sibling of first child 49 var nextSib = currentNode.nextSibling; document.writeln( " " + nextSib.nodeName + 52 ". Value of " + 53 nextSib.nodeName + " element is: " ); var value = nextSib.firstChild; // print the text value of the sibling 58 document.writeln( " " + value.nodeValue + " " + 59 " Parent node of " + nextSib.nodeName + 60 " is: " + 61 nextSib.parentNode.nodeName + ". " ); 62 --> Retrieve the root node’s first child node (i.e., title ) using property firstChild. Property parentNode returns a node’s parent node.

Ingeniørhøjskolen i Århus Slide 35 af 38 Program Output

Ingeniørhøjskolen i Århus Slide 36 af 38 Tools XML-Spy: Sun’s Stylus Studio: Others: –API’s for programmatic access

Ingeniørhøjskolen i Århus Slide 37 af 38 Formatting XSL & CSS XML is only content – no formatting Possible to transform the data to XHTML (or other) using JavaScript og server-side The W3C ideal is using CSS or XSL – eXtensible Style Sheets CSS is most common today– but XSL has more features

Ingeniørhøjskolen i Århus Slide 38 af 38 The 3 Main Technologies of XSL XSLT, a language for transforming information XSL or XSL-FO, a language for formatting information XPath, a language for defining parts of an XML document and accessing them Each of these elements could fill an entire class. We will be dealing with them in a later course