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 [email protected]

1 Copyright © 2007, David J. Malan . All Rights Reserved.

Computer Science E-259 Last Time ƒ ƒ ƒ

DOM Level 3 JAXP 1.3 and Xerces 2.7.1 My First XML Parser

2 Copyright © 2007, David J. Malan . All Rights Reserved.

Last Time DOM Level 3 Document

Comment Jim Bob graduate Text: \n\t

Text: \n\t\t

Element: name

Text: Jim Bob

Element: students

Element: student

Text: \n\t\t

Attr: id

Element: status

Text: \n

Text: \n\t

Text: graduate

3 Copyright © 2007, David J. Malan . All Rights Reserved.

Last Time JAXP 1.3 and Xerces 2.7.1 javax.xml.parsers.DocumentBuilderFactory javax.xml.parsers.DocumentBuilder org.w3c.dom.* ...

4 Copyright © 2007, David J. Malan . All Rights Reserved.

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

5 Copyright © 2007, David J. Malan . All Rights Reserved.

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 Copyright © 2007, David J. Malan . All Rights Reserved.

CSS Level 2 By Example

7 Copyright © 2007, David J. Malan . All Rights Reserved.

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 Copyright © 2007, David J. Malan . All Rights Reserved.

XPath 1.0 (and 2.0) Location Paths

/child::movies/child::movie[@rating='R']

step

axis

node test

predicate

location path

9 Copyright © 2007, David J. Malan . All Rights Reserved.

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 Copyright © 2007, David J. Malan . All Rights Reserved.

XPath 1.0 (and 2.0) following-sibling

1

2

11 Copyright © 2007, David J. Malan . All Rights Reserved.

XPath 1.0 (and 2.0) descendant

1

3

2

4

5

6

12 Copyright © 2007, David J. Malan . All Rights Reserved.

XPath 1.0 (and 2.0) ancestor 2

1

13 Copyright © 2007, David J. Malan . All Rights Reserved.

XPath 1.0 (and 2.0) ...

14 Copyright © 2007, David J. Malan . All Rights Reserved.

XPath 1.0 (and 2.0) Node Tests ƒ ƒ ƒ ƒ ƒ ƒ ƒ ƒ

foo foo:bar foo:* * node() comment() text() processing-instruction()

15 Copyright © 2007, David J. Malan . All Rights Reserved.

XPath 1.0 (and 2.0) Abbreviated Synatx ƒ ƒ ƒ ƒ ƒ

child:: attribute:: /descendant-or-self::node()/ self::node() parent::node()

≡ ≡ ≡ ≡ ≡

'' @ // . ..

16 Copyright © 2007, David J. Malan . All Rights Reserved.

XPath 1.0 (and 2.0) Data Types ƒ ƒ ƒ ƒ ƒ

boolean number string node-set external object

17 Copyright © 2007, David J. Malan . All Rights Reserved.

XPath 1.0 (and 2.0) boolean ƒ ƒ ƒ ƒ

true(), false() =, !=, <, >, <=, >= and, or not()

18 Copyright © 2007, David J. Malan . All Rights Reserved.

XPath 1.0 (and 2.0) number ƒ ƒ ƒ ƒ

=, !=, <, >, <=, >= +, -, *, div, mod, floor(), ceiling() ...

19 Copyright © 2007, David J. Malan . All Rights Reserved.

XPath 1.0 (and 2.0) string ƒ ƒ

ƒ

"foo", 'foo' concat(), contains(), starts-with(), string-length(), substring(), substring-after(), substring-before(), translate() ...

20 Copyright © 2007, David J. Malan . All Rights Reserved.

XPath 1.0 (and 2.0) node set ƒ ƒ ƒ

count(), current(), last(), name(), position(), sum() | ...

21 Copyright © 2007, David J. Malan . All Rights Reserved.

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 Copyright © 2007, David J. Malan . All Rights Reserved.

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 Copyright © 2007, David J. Malan . All Rights Reserved.

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 Copyright © 2007, David J. Malan . All Rights Reserved.

XSLT 1.0 (and 2.0) XHTML 1.0 My First XSLT-Generated Webpage

25 Copyright © 2007, David J. Malan . All Rights Reserved.

XSLT 1.0 (and 2.0) Nodes ƒ ƒ ƒ ƒ ƒ ƒ ƒ

root node element nodes attribute nodes text nodes comment nodes PI nodes ...

26 Copyright © 2007, David J. Malan . All Rights Reserved.

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 Copyright © 2007, David J. Malan . All Rights Reserved.

XSLT 1.0 (and 2.0) Matching Templates ... ...

28 Copyright © 2007, David J. Malan . All Rights Reserved.

XSLT 1.0 (and 2.0) Named Templates ... ...

29 Copyright © 2007, David J. Malan . All Rights Reserved.

XSLT 1.0 (and 2.0) Applying Templates

30 Copyright © 2007, David J. Malan . All Rights Reserved.

XSLT 1.0 (and 2.0) Built-In Templates

31 Copyright © 2007, David J. Malan . All Rights Reserved.

XSLT 1.0 (and 2.0) Values of Nodes

32 Copyright © 2007, David J. Malan . All Rights Reserved.

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, selects nodes to which the processor recursively applies the same algorithm: match templates and instantiate their bodies

33 Copyright © 2007, David J. Malan . All Rights Reserved.

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 Copyright © 2007, David J. Malan . All Rights Reserved.

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

35 Copyright © 2007, David J. Malan . All Rights Reserved.

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

36 Copyright © 2007, David J. Malan . All Rights Reserved.

Project 2 Overview ƒ ƒ ƒ

It's B2B Time! My Blockbuster XTube

37 Copyright © 2007, David J. Malan . All Rights Reserved.

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 Copyright © 2007, David J. Malan . All Rights Reserved.

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 [email protected]

39 Copyright © 2007, David J. Malan . All Rights Reserved.

Computer Science E-259 XML with Java Lecture 4: XPath 1.0

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 [email protected] ...

83KB Sizes 3 Downloads 173 Views

Recommend Documents

Computer Science E-259 XML with Java Lecture 2
Sep 24, 2007 - This is an XML document that describes students -->.

XML Schema - Computer Science E-259: XML with Java
Dec 3, 2007 - ..... An all group is used to indicate that all elements should appear, in any ...

Computer Science E-259 XML with Java Lecture 11: Web Services ...
Apr 13, 2005 - All Rights Reserved. Computer Science E-259. XML with Java. Lecture 11: Web Services, SOAP 1.2, and WSDL 1.1. 10 December 2007.

Syllabus - Computer Science E-259: XML with Java
Oct 15, 2007 - ... standard APIs like JAXP and TrAX, and industry-standard software like Ant, Tomcat, ..... XSLT: Programmer's Reference, Second Edition.

Computer Science E-259 Lectures - Computer Science E-259: XML ...
Sep 17, 2007 - most important new technology development of the last two years." Michael Vizard ... applications: what are the tools and technologies necessary to put ... XML. When. ▫ The World Wide Web Consortium (W3C) formed an XML.

Lecture Notes in Computer Science
study aims to examine the effectiveness of alternative indicators based on wavelets, instead of some technical ..... In this paper, the energy, entropy and others of CJ(k), wavelet coefficients at level J, .... Max depth of initial individual program

Lecture Notes in Computer Science
... S and Geetha T V. Department of Computer Science and Engineering, .... concept than A. If the matching degree is unclassified then either concept A or B is.

Lecture Notes in Computer Science
tinct systems that are used within an enterprising organization. .... files and their networks of personal friends or associates, Meetup organizes local ..... ployed, and in a busy community any deleted pages will normally reappear if they are.

Lecture Notes in Computer Science
forecasting by means of Financial Genetic Programming (FGP), a genetic pro- ... Address for correspondence: Jin Li, CERCIA, School of Computer Science, The ...

Lecture Notes in Computer Science
This is about twice the data generated in 1999, given an increasing ... the very same pre-processing tools and data have been used by all of them. We chose.

Lecture Notes in Computer Science
Abstract. In this paper, we present an approach for detecting and classifying attacks in computer networks by using neural networks. Specifically, a design of an intruder detection system is presented to protect the hypertext transfer protocol (HTTP)

Lectures / Lecture 4
Mar 1, 2010 - Exam 1 is next week during normal lecture hours. You'll find resources to help you prepare for the exam, which will be comprehensive, on the.

Computer Science 75 Fall 2009 Scribe Notes Lecture 4: October 5 ...
interoperable (languages, platforms, applications). ∗ e.g., between Java and Python or between ... markup language), which was developed in the mid-1980s. • To quote W3C: “XML isn't always the best ... it be on the web or mobile devices or in p

Lectures / Lecture 4
Mar 1, 2010 - course website. After lecture today, there will also be a review section. • Assignments are graded on a /–, /, /+ basis whereas exams are graded.

pdf to xml converter java
Page 1. Whoops! There was a problem loading more pages. pdf to xml converter java. pdf to xml converter java. Open. Extract. Open with. Sign In. Main menu.

Computer Science E-1 Spring 2010 Scribe Notes Lecture 4: March 1 ...
time. 2 The Internet (3:00–100:00). 2.1 DNS (3:00–5:00, 12:00–20:00). • Recall from last week that when you type in a URL into your browser's address bar, one ...

Lecture: 4
Page 1 ... WAP to print ASCII value of a given digit or alphabet or special character. WAP to input two ... WAP to create a Guessing game using three player.

Lecture: 10
Create a class Circle derived from Point class. Apart from data of Point class circle should store its radius. W rite constructor and appropriate methods .

Computer Science E-1 Spring 2010 Scribe Notes Lecture 4: March 1 ...
Computer Science E-1. Spring 2010. Scribe Notes. Lecture 4: March 1, 2010. Andrew Sellergren. Contents. 1 Introduction (0:00–3:00). 2. 2 The Internet ...

Computer Science 75 Fall 2009 Scribe Notes Lecture 4: October 5 ...
a stylesheet specified, Firefox will display XML so that its elements are collapsible. ... 2.3 History. • XML developed out of SGML, which displays tremendous flexibility. We see this flexibility in HTML, which is a specific manifestation of SGML.

CS425_ Computer Networks_ Lecture 10.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. CS425_ ...

xml java tutorial pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. xml java tutorial ...

pdf to xml conversion java
Sign in. Loading… Whoops! There was a problem loading more pages. Retrying... Whoops! There was a problem previewing this document. Retrying.

Lecture 4 of 4.pdf
Page 2 of 13. Lecture 4. • REFERENCING EXTERNAL FILES. • ODS. • LAG & RETAIN. • ARRAYS. • SAS GRAPH. •MACROS. •STATA. Page 2 of 13 ...