Computer Science E-259

Similar documents
Markup Sprachen und semi-strukturierte Daten

XSL - Introduction and guided tour

T XML in 2 lessons! %! " #$& $ "#& ) ' */,: -.,0+(. ". "'- (. 1

XML and Data Management

By Nabil ADOUI, member of the 4D Technical Support team

XML WEB TECHNOLOGIES

Markup Languages and Semistructured Data - SS 02

Extending XSLT with Java and C#

XSLT Mapping in SAP PI 7.1

Computer Science E-259

XPath Processing in a Nutshell

IMPLEMENTING AN XML COURSE IN THE COLLEGE OF BUSINESS

XSLT - A Beginner's Glossary

aconferenceonxml Lesser Town Campus Prague, Czech Republic June 17-18, 2006

Database & Information Systems Group Prof. Marc H. Scholl. XML & Databases. Tutorial. 11. SQL Compilation, XPath Symmetries

Interactive, dynamic Scalable Vector Graphics

Creating a TEI-Based Website with the exist XML Database

Last Week. XML (extensible Markup Language) HTML Deficiencies. XML Advantages. Syntax of XML DHTML. Applets. Modifying DOM Event bubbling

Electronic Bank Account Management - EBAM

10CS73:Web Programming

Data Integration through XML/XSLT. Presenter: Xin Gu

XML and Tools. Muhammad Khalid Sohail Khan Mat #: University of Duisburg Essen Germany

Building A Very Simple Website

Document Builder. Thien Tran Department of Computer Science San Jose State University

BCS THE CHARTERED INSTITUTE FOR IT. BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 6 Professional Graduate Diploma in IT WEB ENGINEERING

Chapter 3: XML Namespaces

Speech Interface Implementation for XML Browser

Introduction to XML Applications

XSL Elements. xsl:copy-of

Stylus Studio 2010 XML Feature Comparison Matrix

High Performance XML Data Retrieval

CST6445: Web Services Development with Java and XML Lesson 1 Introduction To Web Services Skilltop Technology Limited. All rights reserved.

Start learning XPath! XPath Nodes This chapter defines the different types of nodes in XPath and the relationship of nodes.

Enabling Web Services

Pushing XML Main Memory Databases to their Limits

Session Topic. Session Objectives. Extreme Java G XML Data Processing for Java MOM and POP Applications

Web Server Logs Analyze Using the XML Technologies

PELLISSIPPI STATE TECHNICAL COMMUNITY COLLEGE MASTER SYLLABUS CIW XML/DHTML/CSS/XHTML WEB 2350

Exchanger XML Editor - Canonicalization and XML Digital Signatures

INTRO TO XMLSPY (IXS)

Extending the Linked Data API with RDFa

CSET 3100 Advanced Website Design (3 semester credit hours) IT Required

Invited Expert on XForms and HTML Working Group

How To Create A Data Transformation And Data Visualization Tool In Java (Xslt) (Programming) (Data Visualization) (Business Process) (Code) (Powerpoint) (Scripting) (Xsv) (Mapper) (

WTP-101 Developing Rich Internet Applications with Java Web Frameworks

Overview of DatadiagramML

PHP Oracle Web Development Data Processing, Security, Caching, XML, Web Services and AJAX

Rigorous and Automatic Testing of Web Applications

REDUCING THE COST OF GROUND SYSTEM DEVELOPMENT AND MISSION OPERATIONS USING AUTOMATED XML TECHNOLOGIES. Jesse Wright Jet Propulsion Laboratory,

XSLT File Types and Their Advantages

WebSphere Business Monitor

Interactive Data Visualization for the Web Scott Murray

Agenda Summary of Previous Session

IBM Tivoli Federated Identity Manager V6.2.2 Implementation. Version: Demo. Page <<1/10>>

Red Hat Enterprise Portal Server: Architecture and Features

Get Success in Passing Your Certification Exam at first attempt!

INTEROPERABILITY BETWEEN VISUAL UML DESIGN APPLICATIONS AND AUTHORING TOOLS FOR LEARNING DESIGN

Application development in XML

XML Processing and Web Services. Chapter 17

Developing XML Solutions with JavaServer Pages Technology

Agents and Web Services

Storing and Querying Ordered XML Using a Relational Database System

WEB DEVELOPMENT COURSE (PHP/ MYSQL)

Java 2 Platform, Enterprise Edition (J2EE): Enabling Technologies for EAI

WWW. World Wide Web Aka The Internet. dr. C. P. J. Koymans. Informatics Institute Universiteit van Amsterdam. November 30, 2007

Structured vs. unstructured data. Motivation for self describing data. Enter semistructured data. Databases are highly structured

How To Write An Xml Document In Java (Java) (Java.Com) (For Free) (Programming) (Web) (Permanent) (Powerpoint) (Networking) (Html) (Procedure) (Lang

WTP-101 Developing Web Applications with Standards. using W3C org standard technologies such as, HTML, CSS, XML, XSD and XSL

Unified XML/relational storage March The IBM approach to unified XML/relational databases

Filen ex_e.xml. Her kommer koderne Det der står skrevet med fed er ændret af grp <?xml version="1.0"?>

F O R U M N O K I A. Implementing Trucking Logistics with Nokia Handsets. Version 1.0; July 18, Java /XML

GRAPH DATA CONVERSION AND TREE VISUALIZATION

Connecting e-commerce to XML

2 Problem description

Selenium Automation set up with TestNG and Eclipse- A Beginners Guide

Exploiting XML Digital Signature Implementations

An XML Based Data Exchange Model for Power System Studies

An Overview of XML and Related Technologies

IT6503 WEB PROGRAMMING. Unit-I

Cleo Communications. CUEScript Training

OOML: Structured Approach to Web Development

Practical Security Evaluation of SAML-based Single Sign-On Solutions

Tutorial Build a simple IBM Rational Publishing Engine (RPE) template for IBM Rational DOORS

Introduction to Ingeniux Forms Builder. 90 minute Course CMSFB-V6 P

What's new in 3.0 (XSLT/XPath/XQuery) (plus XML Schema 1.1) Michael Kay Saxonica

JobScheduler Web Services Executing JobScheduler commands

Web. Services. Web Technologies. Today. Web. Technologies. Internet WWW. Protocols TCP/IP HTTP. Apache. Next Time. Lecture # Apache.

Java and XSLT. Java and XSLT. By GiantDino. Eric M. Burke Publisher: O'Reilly First Edition September 2001 ISBN: , 528 pages

Using Altova Tools with DB2 purexml

MadCap Software. Import Guide. Flare 11

By Koji MIYAUCHI* ABSTRACT. XML is spreading quickly as a format for electronic documents and messages. As a consequence,

Ficha técnica de curso Código: IFCAD320a

VERSION 3.0. REMARKS Documentation rev 01. November CREATOR Douglas J. Robar, Percipient Studios. LICENSE MIT License

An Oracle White Paper May Creating Custom PDF Reports with Oracle Application Express and the APEX Listener

XLIFF 1.2. A white paper on version 1.2 of the XML Localisation Interchange File Format (XLIFF)

Server-Side Web Development JSP. Today. Web Servers. Static HTML Directives. Actions Comments Tag Libraries Implicit Objects. Apache.

Web Programming Step by Step

Developers Guide. Designs and Layouts HOW TO IMPLEMENT WEBSITE DESIGNS IN DYNAMICWEB. Version: English

Data XML and XQuery A language that can combine and transform data

XML Integrated Development Environments Accelerating XML Application Development in the Enterprise

Transcription:

Computer Science E-259 XML with Java Lecture 4: XPath 1.0 (and 2.0) and XSLT 1.0 (and 2.0) 15 October 2007 David J. Malan malan@post.harvard.edu 1

Computer Science E-259 Last Time DOM Level 3 JAXP 1.3 and Xerces 2.7.1 My First XML Parser 2

Last Time DOM Level 3 <!-- This is an example document --> <students> <student id="0001"> <name>jim Bob</name> <status>graduate</status> </student> </students> Comment Document Element: students Text: \n\t Element: student Attr: id Text: \n Text: \n\t\t Element: name Text: \n\t\t Element: status Text: \n\t Text: Jim Bob Text: graduate 3

Last Time JAXP 1.3 and Xerces 2.7.1 javax.xml.parsers.documentbuilderfactory javax.xml.parsers.documentbuilder org.w3c.dom.*... 4

Last Time My First XML Parser cscie259.project1.mf.* 5

Computer Science E-259 This Time CSS Level 2 XPath 1.0 (and 2.0) XSLT 1.0 (and 2.0) TrAX Project 2 6

CSS Level 2 By Example <?xml-stylesheet type="text/css" href="myblockbuster.css"?> 7

XPath 1.0 (and 2.0) History XML Path Language (XPath) Version 1.0 is a Recommendation since 11/99 XML Path Language (XPath) Version 2.0 is a Recommendation since 1/07 8

XPath 1.0 (and 2.0) Location Paths /child::movies/child::movie[@rating='r'] step axis node test predicate location path 9

XPath 1.0 (and 2.0) Axes ancestor, ancestor-or-self attribute child descendant, descendant-or-self following, following-sibling namespace parent preceding, preceding-sibling self 10

XPath 1.0 (and 2.0) following-sibling 1 2 11

XPath 1.0 (and 2.0) descendant 1 3 2 4 5 6 12

XPath 1.0 (and 2.0) ancestor 2 1 13

XPath 1.0 (and 2.0)... 14

XPath 1.0 (and 2.0) Node Tests foo foo:bar foo:* * node() comment() text() processing-instruction() 15

XPath 1.0 (and 2.0) Abbreviated Synatx child:: '' attribute:: @ /descendant-or-self::node()/ // self::node(). parent::node().. 16

XPath 1.0 (and 2.0) Data Types boolean number string node-set external object 17

XPath 1.0 (and 2.0) boolean true(), false() =,!=, <, >, <=, >= and, or not() 18

XPath 1.0 (and 2.0) number =,!=, <, >, <=, >= +, -, *, div, mod, - floor(), ceiling()... 19

XPath 1.0 (and 2.0) string "foo", 'foo' concat(), contains(), starts-with(), string-length(), substring(), substring-after(), substring-before(), translate()... 20

XPath 1.0 (and 2.0) node set count(), current(), last(), name(), position(), sum()... 21

XPath 1.0 (and 2.0) Converting Types Explicit Conversion boolean(), string(), number() Implicit Conversion false» 0, true» 1 false» 'false', true» 'true' 0» false, other» true ''» false, other» true empty» false, other» true... 22

XSLT 1.0 (and 2.0) Motivation XML provides a syntax for structured data formats No one format is likely to enable all possible uses for data Transforming XML can be useful in two different scenarios Data conversion: transforming one format to another Multiple data formats for B2B purchase orders Different description formats for family trees Publishing: transforming data to a human viewable form Displaying XML data on the Web as HTML Displaying XML data in print using PDF 23

XSLT 1.0 (and 2.0) History XSL Transformations (XSLT) Version 1.0 is a Recommendation since 11/99 (first draft dates back to 8/98) XSL Transformations (XSLT) Version 2.0 is a Recommendation since 1/07 24

XSLT 1.0 (and 2.0) XHTML 1.0 <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:param name="foo"/> <xsl:output doctype-public="-//w3c//dtd XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd" encoding="iso-8859-1" indent="yes" method="xml"/> <xsl:template match="/"> <html> <head> <title>my First XSLT-Generated Webpage</title> </head> <body/> </html> </xsl:template> </xsl:stylesheet> 25

XSLT 1.0 (and 2.0) Nodes root node element nodes attribute nodes text nodes comment nodes PI nodes... 26

XSLT 1.0 (and 2.0) Elements xsl:stylesheet xsl:apply-templates, xsl:call-template, xsl:template, xsl:with-param xsl:for-each xsl:value-of... 27

XSLT 1.0 (and 2.0) Matching Templates <xsl:template match="/">... </xsl:template> <xsl:template match="foo">... </xsl:template> 28

XSLT 1.0 (and 2.0) Named Templates <xsl:template name="foo"> <xsl:param name="bar" select="'baz'"/>... </xsl:template> <xsl:call-template name="foo"> <xsl:with-param name="bar" select="'not bar'"/>... </xsl:template> 29

XSLT 1.0 (and 2.0) Applying Templates <xsl:apply-templates select="..."/> 30

XSLT 1.0 (and 2.0) Built-In Templates <xsl:template match="* /"> <xsl:apply-templates/> </xsl:template> <xsl:template match="text() @*"> <xsl:value-of select="."/> </xsl:template> <xsl:template match="comment() processing-instruction()"/> 31

XSLT 1.0 (and 2.0) Values of Nodes <xsl:value-of select="..."/> 32

XSLT 1.0 (and 2.0) Recursive Descent Processing Start from the root node Find a matching template Instantiate the body of the template Send literal result elements (i.e., non-xslt elements) to standard output Interpret XSLT elements as instructions In other words, <xsl:apply-templates/> selects nodes to which the processor recursively applies the same algorithm: match templates and instantiate their bodies 33

XSLT 1.0 (and 2.0) Processors Xalan-J 2.7.0 java org.apache.xalan.xslt.process -IN foo.xml -XSL foo.xsl Microsoft Core XML Services (MSXML) 6.0 SAXON 8.9 Stylus Studio 2007 XML Enterprise Suite XMLSpy 2008 Enterprise Edition... 34

XSLT 1.0 (and 2.0) Versus CSS Level 2 Why two stylesheet languages? 35

TrAX APIs javax.xml.transform.* javax.xml.transform.stream.* javax.xml.transform.dom.* javax.xml.transform.sax.* 36

Project 2 Overview It's B2B Time! My Blockbuster XTube 37

Next Time XPath 1.0 (and 2.0) and XSLT 1.0 (and 2.0), Continued XPath 1.0 (and 2.0), Continued XSLT 1.0 (and 2.0), Continued 38

Computer Science E-259 XML with Java Lecture 4: XPath 1.0 (and 2.0) and XSLT 1.0 (and 2.0) 15 October 2007 David J. Malan malan@post.harvard.edu 39