Structured-Document Processing Languages Spring 2011 Course Review Repetitio mater studiorum est!

Slides:



Advertisements
Similar presentations
J0 1 Marco Ronchetti - Web architectures – Laurea Specialistica in Informatica – Università di Trento Java XML parsing.
Advertisements

XML: Extensible Markup Language
Introduction XML Technologies Mark Graves. This presentation is Copyright 2001, 2002 by Mark Graves and contains material Copyright 2002 by Prentice Hall.
XML Parsing Using Java APIs AIP Independence project Fall 2010.
SDPL 2002Notes 3: XML Processor Interfaces1 3.3 JAXP: Java API for XML Processing n How can applications use XML processors? –A Java-based answer: through.
SDPL 2003Notes 3: XML Processor Interfaces1 3.3 JAXP: Java API for XML Processing n How can applications use XML processors? –A Java-based answer: through.
31 Signs That Technology Has Taken Over Your Life: #6. When you go into a computer store, you eavesdrop on a salesperson talking with customers -- and.
Java API for XML Processing (JAXP) CSE 4/586: Distributed Systems Department of Computer Science and Engineering University at Buffalo, New York Jia Zhao.
MC365 XML Parsers. Today We Will Cover: An overview of the Java API’s used for XML processing Creating an XML document in Java Parsing an XML document.
28-Jun-15 StAX Streaming API for XML. XML parser comparisons DOM is Memory intensive Read-write Typically used for documents smaller than 10 MB SAX is.
Cornell CS 502 Markup Languages SGML, HTML, XML, XHTML CS 502 – Carl Lagoze – Cornell University.
XML: Java Dr Andy Evans. Java and XML Couple of things we might want to do: Parse/write data as XML. Load and save objects as XML. We’ll mainly discuss.
SDPL : (XML APIs) JAXP1 3.3 JAXP: Java API for XML Processing n How can applications use XML processors? –In Java: through JAXP –An overview of.
1 CS122B: Projects in Databases and Web Applications Spring 2015 Notes 05: XML Professor Chen Li Department of Computer Science UC Irvine CS122BNotes 05:
CSE 6331 © Leonidas Fegaras XML Tools1 XML Tools Leonidas Fegaras.
XML Anisha K J Jerrin Thomas. Outline  Introduction  Structure of an XML Page  Well-formed & Valid XML Documents  DTD – Elements, Attributes, Entities.
SDPL 2003Notes 3: XML Processor Interfaces1 3. XML Processor APIs n How can applications manipulate structured documents? –An overview of document parser.
XML processing in ColdFusion MX Everything you wanted to know about XML, but were afraid to ask October 2006 Jaxfusion User Group.
1 XML at a neighborhood university near you Innovation 2005 September 16, 2005 Kwok-Bun Yue University of Houston-Clear Lake.
Representing Web Data: XML CSI 3140 WWW Structures, Techniques and Standards.
Lecture 2 : Understanding the Document Object Model (DOM) UFCFR Advanced Topics in Web Development II 2014/15 SHAPE Hong Kong.
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.
SDPL 2004Notes 3: XML Processor Interfaces1 3.3 JAXP: Java API for XML Processing n How can applications use XML processors? –A Java-based answer: through.
Structured-Document Processing Languages Spring 2005 Course Review Repetitio mater studiorum est!
Advanced Java Session 9 New York University School of Continuing and Professional Studies.
CSE 6331 © Leonidas Fegaras XML Tools1 XML Tools.
SDPL 2002Notes 3: XML Processor Interfaces1 3. XML Processor APIs n How can applications manipulate structured documents? –An overview of document parser.
SDPL 20113: XML APIs and SAX1 3. XML Processor APIs n How can (Java) applications manipulate structured (XML) documents? –An overview of XML processor.
Intro. to XML & XML DB Bun Yue Professor, CS/CIS UHCL.
Processing of structured documents Spring 2002, Part 2 Helena Ahonen-Myka.
XML Parsers Overview  Types of parsers  Using XML parsers  SAX  DOM  DOM versus SAX  Products  Conclusion.
XML and Web Services CS409 Application Services Even Semester 2007.
Java API for XML Processing (JAXP) Dr. Rebhi S. Baraka Advanced Topics in Information Technology (SICT 4310) Department of Computer.
SDPL 2002Notes 3.2: Document Object Model1 3.2 Document Object Model (DOM) n How to provide uniform access to structured documents in diverse applications.
Sheet 1XML Technology in E-Commerce 2001Lecture 3 XML Technology in E-Commerce Lecture 3 DOM and SAX.
SDPL Streaming API for XML1 3.4 Streaming API for XML (StAX) n Could we process XML documents more conveniently than with SAX, and yet more efficiently?
SDPL 20112: XML Basics1 2 Basics of XML and XML documents Survivor's Guide to XML, or XML for Computer Scientists / Dummies 2.1 XML and XML documents 2.2.
CSE 6331 © Leonidas Fegaras XML Tools1 XML Tools.
CS 157B: Database Management Systems II February 11 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron.
SAX2 and DOM2 Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
XML. What is XML? XML stands for EXtensible Markup Language.XML is a markup language much like HTML. XML was designed to describe data. XML was created.
XML and SAX (A quick overview) ● What is XML? ● What are SAX and DOM? ● Using SAX.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 1COMP9321, 15s2, Week.
Structured-Document Processing Languages Spring 2007 Course Review Repetitio mater studiorum est!
Web Technologies Lecture 4 XML and XHTML. XML Extensible Markup Language Set of rules for encoding a document in a format readable – By humans, and –
Dom and XSLT Dom – document object model DOM – collection of nodes in a tree.
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.
What is XML? eXtensible Markup Language eXtensible Markup Language A subset of SGML (Standard Generalized Markup Language) A subset of SGML (Standard Generalized.
XML and Object Serialization. Structure of an XML Document Header Root Element Start Tags / End Tags Element Contents – Child Elements – Text – Both (mixed.
1 Introduction JAXP. Objectives  XML Parser  Parsing and Parsers  JAXP interfaces  Workshops 2.
Structured-Document Processing Languages Spring 2004 Course Review Repetitio mater studiorum est!
Web services. DOM parsing and SOAP.. Summary. ● Exercise: SAX-Based checkInvoice(), ● push parsing, ● event-based parsing, ● traversal order is depth-first.
SDPL 2002Notes 3.2: Document Object Model1 The Misconceived Web n The original vision of the WWW was as a hyperlinked document-retrieval system. n It did.
Martin Kruliš by Martin Kruliš (v1.1)1.
Structured-Document Processing Languages (3 cu/6 ECTS cp), Spring 2007 Pekka Kilpeläinen University of Kuopio Department of Computer Science
SDPL 20063: XML Processor Interfaces1 3. XML Processor APIs n How can (Java) applications manipulate structured (XML) documents? –An overview of XML processor.
Structured-Document Processing Languages (5 cp), Spring 2011 Pekka Kilpeläinen University of Eastern Finland School of Computing
SDPL 2005Notes 7: XQuery1 7 Querying XML n How to access different sources (DBs, docs) as XML? n XQuery, W3C XML Query Language –"work in progress", (last.
Week-9 (Lecture-1) XML DTD (Data Type Document): An XML document with correct syntax is called "Well Formed". An XML document validated against a DTD is.
I Copyright © 2004, Oracle. All rights reserved. Introduction.
1 Introduction to XML Babak Esfandiari. 2 What is XML? introduced by W3C in 98 Stands for eXtensible Markup Language it is more general than HTML, but.
XML Parsers Overview Types of parsers Using XML parsers SAX DOM
XML: Extensible Markup Language
Unit 4 Representing Web Data: XML
Java XML IS
{ XML Technologies } BY: DR. M’HAMED MATAOUI
XML in Web Technologies
Database Processing with XML
Chapter 7 Representing Web Data: XML
XML Parsers Overview Types of parsers Using XML parsers SAX DOM
Presentation transcript:

Structured-Document Processing Languages Spring 2011 Course Review Repetitio mater studiorum est!

SDPL 2011Course Review2 Goals of the Course n Learn about central models and languages for –manipulating –transforming and –querying structured documents (or XML) n "Generic XML processing technology"

SDPL 2011Course Review3 XML? n Extensible Markup Language is not a markup language! –does not fix a tag set nor its semantics (like markup languages like HTML do) n XML is –A way to use markup to represent information –A metalanguage »supports definition of specific markup languages through XML DTDs or Schemas »E.g. XHTML a reformulation of HTML using XML

SDPL 2011Course Review4 XML Encoding of Structure: Example <S> S E <W></W> Hithere! W Hi Hi W there! </W> </S> b=2A=1

SDPL 2011Course Review5 Basics of XML DTDs n A Document Type Declaration provides a grammar (document type definition, DTD) for a class of documents Syntax (in the prolog of document instance): [ ]> Syntax (in the prolog of document instance): [ ]> n DTD = union of the external and internal subset

SDPL 2011Course Review6 Example DTD <!ATTLIST item price NMTOKEN #REQUIRED unit (FIM | EUR) ”EUR” >

Lang/Model Purpose Structure of Processing (i) docs model (i) docs model (ii) model (ii) model SDPL 2011Course Review7 Review

SDPL 2011Course Review8 XML Namespaces </xsl:template></xsl:stylesheet>

SDPL 2011Course Review9 3. XML Processor APIs n How can applications manipulate structured (XML) documents? –An overview of XML processor interfaces 3.1 SAX: an event-based interface 3.2 DOM: an object-based interface 3.3 JAXP: Java API for XML Processing 3.4 StAX: Streaming API for XML

SDPL 2011Course Review10 A SAX-based application Application Main Routine startDocument() startElement() characters() parse() Callback Routines endElement() </A>Hi! "A",[i="1"] "Hi!" "A"

SDPL Course Review

Lang/Model Purpose Structure of Processing (i) docs model (i) docs model (ii) model (ii) model SDPL 2011Course Review12 Review

SDPL 2011Course Review Streaming API for XML (StAX) n Event-driven streaming API, like SAX n "Pull API" –lets the application to ask for individual events n Two sets of APIs: –"cursor" (XMLStreamReader), and "iterator" (XMLEventReader) n Bidirectional: –XMLStreamWriter or XMLEventWriter support "marshaling" data into XML

SDPL 2011Course Review A Pull-Parsing Application ApplicationEventReader.nextEvent() Parser API StartDocument Hi! Characters"Hi!" </A> EndElement"A" StartElement "A",[i="1"] 14

SDPL 2011Course Review15 DOM: What is it? n Object-based, language-neutral API for XML and HTML documents –Allows programs/scripts to »build »navigate and »modify documents n “Directly Obtainable in Memory” vs “Serial Access XML”

SDPL 2011Course Review16 <invoice form="00" type="estimated"> type="estimated"> John Doe John Doe Pyynpolku 1 Pyynpolku KUOPIO KUOPIO DOM structure model invoice name addressdata address form="00"type="estimated" John Doe streetaddresspostoffice KUOPIO Pyynpolku 1... Document Element NamedNodeMap Text

SDPL Course Review

Lang/Model Purpose Structure of Processing (i) docs model (i) docs model (ii) model (ii) model SDPL 2011Course Review18 Review

SDPL 2011Course Review19 XSLT Transformations

Lang/Model Purpose Structure of Processing (i) docs model (i) docs model (ii) model (ii) model SDPL 2011Course Review20 Review

SDPL 2011Course Review21 JAXP (Java API for XML Processing) n Interface for “plugging-in” and using XML processors in standard Java applications –org.xml.sax: SAX 2.0 –javax.xml.stream : StAX –org.w3c.dom: DOM Level 2 (+ Level 3 Core) –javax.xml.parsers: initialization and use of parsers –javax.xml.transform: initialization and use of XSLT transformers

SDPL 2011Course Review22 XML.getXMLReader() JAXP: Using a SAX parser (1) f.xml.parse( ”f.xml”) ”f.xml”).newSAXParser()

SDPL 2011Course Review23 f.xml JAXP: Using a DOM parser (1).parse(”f.xml”).newDocument().newDocumentBuilder()

SDPL 2011Course Review24 XSLT JAXP: Using Transformers (1).newTransformer(…).transform(.,.)

Lang/Model Purpose Structure of Processing (i) docs model (i) docs model (ii) model (ii) model SDPL 2011Course Review25 Review

SDPL 2011Course Review26 W3C XQuery n Functional expression language –A query is a side-effect-free expression n Operates on sequences of items –XML nodes or atomic values Strongly-typed: (XML Schema) types may be assigned to expressions statically, and results can be validated Strongly-typed: (XML Schema) types may be assigned to expressions statically, and results can be validated n Extends XPath 2.0 ( but not all axes required) –common for XQuery 1.0 and XPath 2.0: »Functions and Operators, W3C Rec. 01/2007 n Roughly: XQuery  XPath XSLT' + SQL'

SDPL 2011Course Review27 FLWOR ("flower") Expressions n for, let, where, order by and return clauses (~SQL select-from-where) n Form: (ForClause | LetClause)+ WhereClause? OrderByClause? "return" Expr n binds variables to values, and uses these bindings to construct a result (an ordered sequence of items)

SDPL 2011Course Review28 XQuery Example for $pn in distinct-values( doc(”sp.xml”)//pno) let $sp:=doc(”sp.xml”)//sp_tuple[pno=$pn] where count($sp) >= 3 order by $pn return {$pn} {$pn} {avg($sp/price)} {avg($sp/price)}

Lang/Model Purpose Structure of Processing (i) docs model (i) docs model (ii) model (ii) model SDPL 2011Course Review29 Review

SDPL 2011Course Review30 Course Main Message n XML is a universal way to represent information as tree-like data structures n There are specialized and powerful technologies for processing it –hype has settled –R&D still going on