Client-side Web Engineering 2 From XML to Client-side Mashups. SWE 642, Spring 2008 Nick Duan. February 6, What is XML?

Similar documents
map1.html 1/1 lectures/8/src/

Simple Carpool Application using SAP NetWeaver Portal, KM, XML Forms, and Google Maps

Sergio Luján Mora Department of Software and Computing Systems

Using an ArcGIS Server.Net version 10

Getting started with Franson GpsGate 2.0

WEB MAPPING WITH GOOGLE MAPS MASHUPS: OVERLAYING GEODATA

Markup Languages SGML, HTML, XML, XHTML. CS 431 February 13, 2006 Carl Lagoze Cornell University

Implementing a chat button on TECHNICAL PAPER

Schenker AB. Interface documentation Map integration

Design Project. i385f Special Topics in Information Architecture Instructor: Don Turnbull. Elias Tzoc

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

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

Validator.nu Validation 2.0. Henri Sivonen

Lesson 12: JavaScript and AJAX

Introduction to XML. Asst. Prof. Dr. Kanda Runapongsa Saikaew Dept. of Computer Engineering Khon Kaen University

Introduction to XML 3/14/12. Introduction to XML

Create a cool image gallery using CSS visibility and positioning property

Mash Something. Purdue e-pubs. Purdue University. Christopher C. Miller Purdue University,

Vebra Search Integration Guide

A tutorial report for SENG Agent Based Software Engineering. Course Instructor: Dr. Behrouz H. Far. XML Tutorial.

DEVELOPING A MESSAGE PARSER TO BUILD THE TEST CASE GENERATOR

Structured documents

Brief Introduction to ITU-T H.762 (LIME)

A designers guide to creating & editing templates in EzPz

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

Lake Superior MapBuilder Demo Mapping Mashup Workshop Minnesota GIS/LIS Conference Duluth, Minnesota October 21, 2009

WIRIS quizzes web services Getting started with PHP and Java

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

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

Digital Asset Management 2. Introduction to Digital Media Format

Headings: Application programming interfaces. Geographic information systems. Maps / Internet resources. JavaScript (Computer language)

XML Processing & Web Services. Husni Husni.trunojoyo.ac.id

Data Acquisition using Mashup and 3-D Technology. Matt Rahr College of Agriculture and Life Sciences University of Arizona

OpenLayers: Open Source Map Browser

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

XAP: extensible Ajax Platform

Why HTML5? Why not XHTML2? Learning from history how to drive the future of the Web

Introduction to HTML5

X Slippy Maps. (...and Scott Davis)

CSI 3140 WWW Structures, Techniques and Standards. Markup Languages: XHTML 1.0

Author: Irena Holubová Lecturer: Martin Svoboda

Scripting for Multimedia LECTURE 1: INTRODUCING HTML5

XML. Jonathan Geisler. April 18, 2008

COMP9321 Web Application Engineering

Extensible Markup Language (XML) Hamid Zarrabi-Zadeh Web Programming Fall 2013

Arc en Ciel Ltd. Gazetteer Webservice FactSheet

HTML HTML. Chris Seddon CRS Enterprises Ltd 1

CSC Web Technologies, Spring Web Data Exchange Formats

CHAPTER 2 MARKUP LANGUAGES: XHTML 1.0

Google API Integration

Here are a few easy steps to create a simple timeline. Open up your favorite text or HTML editor and start creating an HTML file.

The XML Metalanguage


Part A Short Answer (50 marks)

11. EXTENSIBLE MARKUP LANGUAGE (XML)

Chapter 10: Understanding the Standards

Tutorial 1 Getting Started with HTML5. HTML, CSS, and Dynamic HTML 5 TH EDITION

Introduction to XML. XML: basic elements

Data Presentation and Markup Languages

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

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

HTML. HTML Evolution

Semantic Web Lecture Part 1. Prof. Do van Thanh

Financial. AngularJS. AngularJS.

HTML Overview. With an emphasis on XHTML

introduction to XHTML

XML is a popular multi-language system, and XHTML depends on it. XML details languages

Internet publishing HTML (XHTML) language. Petr Zámostný room: A-72a phone.:

Financial. AngularJS. AngularJS. Download Full Version :

Scripting. Web Architecture and Information Management [./] Spring 2009 INFO (CCN 42509) Contents

Oracle Application Express Plug-in for Ajax Maps: Map Integration the Easy Way

IT2353 WEB TECHNOLOGY Question Bank UNIT I 1. What is the difference between node and host? 2. What is the purpose of routers? 3. Define protocol. 4.

Chapter 1 Getting Started with HTML 5 1. Chapter 2 Introduction to New Elements in HTML 5 21

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

Notes General. IS 651: Distributed Systems 1

Hospitality Industry Technology Integration Standards Glossary of Terminology

XML Applications. Introduction Jaana Holvikivi 1

997 Functional Acknowledgment (Inbound)

Upper Lake Michigan MapBuilder Demo GLOS Mapping Workshop Traverse City, Michigan November 11, 2009

XML: Extensible Markup Language

XML Extensible Markup Language

Overview

AIM. 10 September

JAVASCRIPT FOR PROGRAMMERS

GIMP WEB 2.0 MENUS. Before we begin this tutorial let s visually compare a standard navigation bar and a web 2.0 navigation bar.

Recall: Document Object Model (DOM)

Terratype Umbraco Multi map provider

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

Comp 426 Midterm Fall 2013

Help Documentation. Copyright 2007 WebAssist.com Corporation All rights reserved.

The main Topics in this lecture are:

XML. Technical Talk. by Svetlana Slavova. CMPT 842, Feb

Some more XML applications and XML-related standards (XLink, XPointer, XForms)

The Google Wave APIs. David Mark Byttow June 5th, 2009

Web Standards Mastering HTML5, CSS3, and XML

XML. Objectives. Duration. Audience. Pre-Requisites

Publishing Technology 101 A Journal Publishing Primer. Mike Hepp Director, Technology Strategy Dartmouth Journal Services

Simplify Web 2.0 with IBM Rational EGL Community Edition

Document Object Model. Overview

Session 23 XML. XML Reading and Reference. Reading. Reference: Session 23 XML. Robert Kelly, 2018

Transcription:

Client-side Web Engineering 2 From XML to Client-side Mashups SWE 642, Spring 2008 Nick Duan February 6, 2008 1 What is XML? XML extensible Markup Language Definition: XML is a markup language for documents containing structured information Markup = "tags" embedded in text content of a document to its structure A subset of the Standard Generalized Markup Language (SGML), which is a ISO standard and widely used in the publishing industry XML is a W3C standard. Latest version is 1.1 http://www.w3.org/tr/2006/rec-xml11-20060816/ February 6, 2008 Nick Duan 2 1

Why XML? HTML is the standard for web browsers, why use another markup language? HTML is used primarily for presentation purposes, e.g. for human-machine interactions HTML can not support machine-to-machine (M2M) data interactions effectively Document structure can not be effectively represented using HTML What is a document and why its structural representation is so important? Document = Structured Information = Computer File To support M2M data exchange, the structure of the document has to be clearly defined February 6, 2008 Nick Duan 3 Sample Doc Structure (JFIF) Field Size (bytes) Description APP0 Marker 2 Always equals 0xFFE0 Length 2 Length of segment excl. APP0 Identifier 5 Always equals "JFIF" in Hex Version 2 1 st byte is major, 2nd byte is minor Density Units 1 Units for pixel density fields X Density 2 Integer horizontal pixel density Y Density 2 Integer vertical pixel density Thumbnail Width 1 Horizontal size of thumbnail in pixels Thumbnail Height 1 Vertical size thumbnail in pixels Thumbnail Data 3 * T-Width * T-Height Uncompressed 24 bit RGB raster thumbnail February 6, 2008 Nick Duan 4 2

EDI X12 820 (Payment Order) ISA*00* *00* *01*123454321 *01*012341234 *031016*2359*U*00401*987600111*0*P*: \GS*RA*123454321*012341234*031016*2359*987600111*X* 004010 \ST*820*987600111 \BPR*C*77.77*C*ACH*CTX*01*234056789*DA*0099109999* *123454321*01*045678099*DA*1008973899*031016 \TRN*1*0310162359 \REF*AA*EDI6 \N1*PR*WHIZCO OF AMERICA INC \N3*55 MEGAPLEASANT ROAD*SUITE 999 \N4*SUPERVILLE*NY*10954 \N1*PE*YOWZACO \ENT*1 \RMR*AP*1111111111111111*PO*11.11 \RMR*AP*2222222222222222*PO*22.22 \RMR*AP*4444444444444444*PO*44.44 \DTM*055*031016 \SE*000000014*987600111 \GE*1*987600111 \IEA*1*987600111\ Itemized POs Total PO amount = $77.77 Address and location info ISA Interchange Control Header GS Function Group Header ST Transaction Set Header SE Transaction Set Trailer GE Function Group Trailer IEA Interchange Control Trailer \ = Segment Delimiter * = Field Delimiter February 6, 2008 Nick Duan 5 Steps in M2M Data Exchange Input Stream ISA*00* *00* \GS*RA*1234 54321*01234 1234*031016* 2359*987600 111*X*004010.. Pre-Processing Parser Internal Data Representation of Document Objects GS ISA GE IEA Post Processing Data Processor ST SE The generic model for document processing Modularity/Reuse is achievable via standardization February 6, 2008 Nick Duan 6 3

Document Pre-processing Post-processing is application-specific (limited reusability) An EDI parser has to be constructed manually for different types of EDI document, because of its structural complexity, even EDI is standardized Even for minor structural changes (e.g. adding a field in a segment), the parser has to be reconstructed The structure of EDI document is defined on paper in non-electronic format February 6, 2008 Nick Duan 7 A document framework for preprocessing A generic framework is needed in support of M2M data exchange Standardization of basic encoding format Text-based encoding for document representation, since it is more flexible and platform/application neutral than binary format Representation of structural information within the document - use predefined tags in docs Codify the structural information of documents Refer as the document metadata Enable the dynamic construction of doc parser February 6, 2008 Nick Duan 8 4

XML-based document framework XML Input File <?xml version="1.0"?> <PaymentOrder> <Amount>77.77 </Amount> <Sender> <name>john </name> Pre-Processing XML Parser Document Object Model (DOM) Amount PaymentOrder Sender DueDate Post Processing Data Processor XML Schema or DTD Name Addr Document Type for XML XML Schema or Document Type Definition (DTD) February 6, 2008 Nick Duan 9 Type definition using XML Schema <?xml version="1.0" encoding="utf-8"?> <PurchaseOrder xsi:nonamespaceschemalocation="purchaseorder.xsd" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <RequisitionNo>485321</RequisitionNo> <Product> <SkuNo>U2322</SkuNo>. </PurchaseOrder> Type definition using DTD <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE PurchaseOrder SYSTEM "PurchaseOrder.dtd"> <PurchaseOrder> <RequisitionNo>485321</RequisitionNo> <Product> <SkuNo>U2322</SkuNo>. </PurchaseOrder> An XML Example xsi refers to the schema instance defined by the XML schema standard SYSTEM refers to the local DTD definition February 6, 2008 Nick Duan 10 The default namespace is represented by the schema file 5

Document Structure Definitions February 6, 2008 Nick Duan 11 What is XML Schema? An abstract data model consists of the basic building blocks for specifying document type definitions of XML documents Enable document validation, making XML a Strongly typed language Schema files are in XML format with the ext. xsd Designed to be scalable and extensible in an object-oriented fashion xsi refers to the basic schema for all schema defs More widely used than DTD since it is designed for M2M data exchange February 6, 2008 Nick Duan 12 6

Pre-Processing of XML Document XML Doc Stream Parser Data binding DOM Tree or other data structure <?XML Version= 1.0?>. SAX or StAX Tokens Tokens Tokens Tokens Tokens DOM builder or languagespecific binding Amount PaymentOrder Sender DueDate Name Addr Document validation can be enforced by stream parser Data binding refers to mapping XML elements to language-specific data structure, e.g. mapping XML elements in a document to Java objects JAXB Java XML Binding February 6, 2008 Nick Duan 13 Applications using XML M2M data exchange Web Services, RSS AJAX, Data Mashups (e.g. GoogleMaps) Document processing and presentation Document translation via XSLT Dynamic publication of document in HTML Software Development and System Admin Declarative programming Software component configuration Software process control (e.g. Ant, Maven) System and Security/access control configuration February 6, 2008 Nick Duan 14 7

Data and Service Mashups What is mashup? A web application that combines data from more than one source into a single integrated tool (Wikipedia) In general, mashup is the concept of integrating data from multiple data sources to create presentation in a new dimension Data mashup for presentation Service mashup for reuse Client-side mashup: AJAX, GoogleMaps, AdobeFlash, etc. Server-side mashup: Proxy or gateway services providing data mapping, conversion, and mediation functions Web Client Client-side Mashups HTML Page with JavaScript Program document XMLHttpRequest XML or other structure Web Server image form area GoogleMapsAPI Map data Google Map Server input button DOM APIs text BrowserParser HTML & Images Information from multiple sources is consolidated on user s web browser Web Content Server February 6, 2008 Nick Duan 16 8

GoogleMaps APIs A set of JavaScript APIs using AJAX concept (based on XMLHttpRequest) To embed GoogleMaps on your own web site using JavaScript To overlay geospatial information from any web source in XML format Overlay data in XML Any Web Server Map data Map Server from Google February 6, 2008 Nick Duan 17 Loading the google map API to this page Sample GoogleMaps Script <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>google Maps JavaScript API Example: Simple Map</title> <script src="http://maps.google.com/maps?file=api&v=2&key=abqiaaaazr2eboxuknm _jvnk0oji7xsosdvg8kkpe1-m51rbrvyughuymxq-i1qfunh94qxwia6n4u6moummba" type="text/javascript"></script> <script type="text/javascript"> function initialize() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map_canvas")); map.setcenter(new GLatLng(37.4419, -122.1419), 13); } } </script> </head> Define the event handling logic for map display <body onload="initialize()" onunload="gunload()"> <div id="map_canvas" style="width: 500px; height: 300px"></div> Map key to be registered with Google Loading the map to specific area referenced as DOM object Define the map display area with a user-defined DOM object ID </body> February </html> 6, 2008 Nick Duan 18 9

Overlay XML Data onto Map function initialize() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map_canvas")); map.setcenter(new GLatLng(37.4419, -122.1419), 13); map.addcontrol(new GSmallMapControl()); map.addcontrol(new GMapTypeControl()); // Download the data in data.xml and load it on the map. The format we // expect is: // <markers> // <marker lat="37.441" lng="-122.141"/> // <marker lat="37.322" lng="-121.213"/> // </markers> GDownloadUrl("./include/data.xml", function(data) { var xml = GXml.parse(data); var markers = xml.documentelement.getelementsbytagname("marker"); for (var i = 0; i < markers.length; i++) { var latlng = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parsefloat(markers[i].getattribute("lng"))); map.addoverlay(new GMarker(latlng)); } }); Load map to specified location of the HTML page Load geo coordinates in XML from local server Set both map controls to be active Add the overlay to map Parse the XML data to retrieve content February 6, 2008 Nick Duan 19 Online References W3C XML (1.1) Specification, 2 nd edition http://www.w3.org/tr/2006/rec-xml11-20060816/ Introduction of XML http://www.xml.com/pub/a/98/10/guide0.html?page=1 XML Schema Primer http://www.w3.org/tr/xmlschema-0/ Tutorial http://www.w3schools.com/schema/default.asp GoogleMaps API and Developer s Guide http://code.google.com/apis/maps/documentation/index.html February 6, 2008 Nick Duan 20 10

Summary XML provides a standard way of presenting structured document for M2M data exchange XML Schema defines the type information of XML document in XML (codified format). It is designed in a extensible, object-oriented fashion, and enables XML to be validated and become strongly typed The codification of document types enables dynamic configuration of document parsers and dynamic data binding in document pre-processing XML technology enables data mashups from different distributed data sources (based on XMLHttpRequest) GoogleMaps APIs provide a rich set of JavaScript tools for mashing up geospatial information with 2D maps, creating an eco environment for data sharing February 6, 2008 Nick Duan 21 Quiz What is the standard for representing an XML document in data structures? What are the steps necessary to create a DOM structure of an XML document in computer memory? What is the GoogleMaps API for retrieving a set of geo-referenced data in XML format? Create a GoogleMaps web page with an overlay of hospital information in the New Orleans region (XML file on class web site) February 6, 2008 Nick Duan 22 11