This PowerPoint is based on slides from: Jason Hunter and Brett McLaughlin.

Slides:



Advertisements
Similar presentations
The Java Platform and XML Portable Code, Portable Data James Duncan Davidson Staff Engineer, Sun Microsystems, Inc.
Advertisements

XB1: Xml Pull Builder V1 Design Notes Aleksander Slominski.
University of Jyväskylä/AHo & VLy Experiences of Document Transformations with XSLT and DOM Anne Honkaranta, Virpi Lyytikäinen, Pasi Tiitinen, University.
Multi-Model Digital Video Library Professor: Michael Lyu Member: Jacky Ma Joan Chung Multi-Model Digital Video Library LYU9904 Multi-Model Digital Video.
JDOM: How It Works, and How It Opened the Java Process by Jason Hunter O'Reilly Open Source Convention 2001 July, 2001.
Java + XML = JDOM by Jason Hunter and Brett McLaughlin XML DevCon November, 2000.
14-Jun-15 DOM. SAX and DOM SAX and DOM are standards for XML parsers-- program APIs to read and interpret XML files DOM is a W3C standard SAX is an ad-hoc.
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.
XML DOM and SAX Parsers By Omar RABI. Introduction to parsers  The word parser comes from compilers  In a compiler, a parser is the module that reads.
XML Parser. Why Need a XML Parser ? Check XML syntax. ( is well-formed ? ) Validation. ( DTD and XML Schema ) Allow programmatic access to the document’s.
Java API for XML Processing (JAXP) CSE 4/586: Distributed Systems Department of Computer Science and Engineering University at Buffalo, New York Jia Zhao.
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.
COMS W3156: Software Engineering, Fall 2001 Lecture #10: Planning and Estimation Janak J Parekh
Document Type Definitions. XML and DTDs A DTD (Document Type Definition) describes the structure of one or more XML documents. Specifically, a DTD describes:
Chapter 13 XML Concept of XML Simple Example of XML XML vs. HTML in Syntax XML Structure DTD and CDATA Sections Concept of SAX Processing Download and.
Java + XML = JDOM by Jason Hunter and Brett McLaughlin co-creators of JDOM Mountain View Java User's Group April 26, 2000.
PHP with XML Dequan Chen and Narith Kun ---Term Project--- for WSU 2010 Summer Course - CS366 s:
Perl/XML::DOM - reading and writing XML from Perl Dr. Andrew C.R. Martin
Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.
XML eXtensible Markup Language by Darrell Payne. Experience Logicon / Sterling Federal C, C++, JavaScript/Jscript, Shell Script, Perl XML Training XML.
XML eXtensible Markup Language w3c standard Why? Store and transport data Easy data exchange Create more languages WSDL (Web Service Description Language)
Java API for XML Processing (JAXP) توسط : محمّدمهدي حامد استاد راهنما : دكتر مسعود رهگذر.
Java + XML = JDOM by Jason Hunter and Brett McLaughlin Enterprise Java O’Reilly Conference March, 2001.
What is XML?  XML stands for EXtensible Markup Language  XML is a markup language much like HTML  XML was designed to carry data, not to display data.
XML Parsers Overview  Types of parsers  Using XML parsers  SAX  DOM  DOM versus SAX  Products  Conclusion.
SAX. What is SAX SAX 1.0 was released on May 11, SAX is a common, event-based API for parsing XML documents Primarily a Java API but there implementations.
Electronic Commerce COMP3210 Session 4: Designing, Building and Evaluating e-Commerce Initiatives – Part II Dr. Paul Walcott Department of Computer Science,
Working with the XML Document Object Model ©NIITeXtensible Markup Language/Lesson 7/Slide 1 of 44 Objectives In this lesson, you will learn to: *Identify.
The XML Document Object Model (DOM) Aug’10 – Dec ’10.
Intro to XML Originally Presented by Clifford Lemoine Modified by Box.
XML Document Object Model Anthony Borquez. The Document Object Model a programming interface for HTML and XML documents. It defines the way a document.
Sheet 1XML Technology in E-Commerce 2001Lecture 3 XML Technology in E-Commerce Lecture 3 DOM and SAX.
Consuming eXtensible Markup Language (XML) feeds.
IS432 Semi-Structured Data Lecture 2: DTD Dr. Gamal Al-Shorbagy.
Java + XML = JDOM by Jason Hunter with Brett McLaughlin Sun HQ Briefing January, 2001.
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.
Web Technologies COMP6115 Session 4: Adding a Database to a Web Site Dr. Paul Walcott Department of Computer Science, Mathematics and Physics University.
AxKit A member of the Apache XML project Ryan Maslyn Kyle Bechtel.
SAX2 and DOM2 Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
XML and SAX (A quick overview) ● What is XML? ● What are SAX and DOM? ● Using SAX.
COSC617 Project XML Tools Mark Liu Sanjay Srivastava Junping Zhang.
CS 157B: Database Management Systems II February 13 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron.
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.
 defined as Extensible Markup Language (XML) is a set of rules for encoding documents  Defines structure and data.
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.
XML Tools (Chapter 4 of XML Book). What tools are needed for a complete XML application? n Fundamental components n Web infrasructure n XML development.
Document Object Model.  The XML DOM (Document Object Model) defines a standard way for accessing and manipulating XML documents.  The DOM presents an.
7-Mar-16 Simple API XML.  SAX and DOM are standards for XML parsers-- program APIs to read and interpret XML files  DOM is a W3C standard  SAX is an.
1 Validation SAX-DOM. Objectives 2  Schema Validation Framework  XML Validation After Transformation  Workshops.
D Copyright © 2004, Oracle. All rights reserved. Using Oracle XML Developer’s Kit.
USING ANDROID WITH THE DOM. Slide 2 Lecture Summary DOM concepts SAX vs DOM parsers Parsing HTTP results The Android DOM implementation.
XML DOM Week 11 Web site:
21-Jun-16 Document Object Model DOM. SAX and DOM SAX and DOM are standards for XML parsers-- program APIs to read and interpret XML files DOM is a W3C.
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.
XML. Contents  Parsing an XML Document  Validating XML Documents.
XML Parsers Overview Types of parsers Using XML parsers SAX DOM
XML Parsers.
Intro to XML.
Week 11 Web site: XML DOM Week 11 Web site:
XML Parsers Overview Types of parsers Using XML parsers SAX DOM
More Sample XML By Sadia Anjum.
DOM 24-Feb-19.
XML: eXtensible Markup Language
Python and XML Styling and other issues XML
XML Parsers.
XML Programming in Java
XML and Web Services (II/2546)
Presentation transcript:

This PowerPoint is based on slides from: Jason Hunter and Brett McLaughlin

Webprogramming (WEBP) 2. Mar By Henrik Høltzer

What is JDOM? JDOM is a way to represent an XML document for easy and efficient reading, manipulation, and writing Straightforward API Lightweight and fast Java-optimized Despite the name similarity, it's not built on DOM or modeled after DOM An open source project with an Apache-style license 950 developers on jdom-interest (high traffic) 800 lurkers on jdom-announce (low traffic)

The JDOM Philosophy JDOM should be straightforward for Java programmers Use the power of the language (Java 2) Take advantage of method overloading, the Collections APIs, reflection, weak references Provide conveniences like type conversions JDOM should hide the complexities of XML wherever possible An Element has text content, not a child Text node with content Exceptions should contain useful error messages Give line numbers and specifics, use no SAX or DOM specifics

More JDOM Philosophy JDOM should integrate with DOM and SAX Reads and writes DOM docs and SAX events Can use any DOM or SAX parser (uses adapter model or can use JAXP) Why not use DOM: Same API on multiple languages, defined using IDL Foreign to the Java environment, Java programmer Fairly heavyweight in memory Why not use SAX: No document modification, random access, or output Fairly steep learning curve to use correctly JDOM is to DOM/SAX as RMI is to CORBA Java optimized, plays well with the other

The org.jdom.input Package Classes for reading XML from existing sources: DOMBuilder SAXBuilder Also, outside contributions in jdom-contrib: ResultSetBuilder SpitfireBuilder

The org.jdom.output Package Classes for writing XML to various forms of output: DOMOutputter SAXOutputter XMLOutputter Also, outside contributions in jdom-contrib: JTreeOutputter

General Program Flow Normally XML Document -> SAXBuilder -> XMLOutputter DOM Node(s) JDOM Document SAXBuilder DOMBuilder XMLOutputter SAXOutputter DOMOutputter XML Document Direct Build

The Document lifecycle Documents are rep. by the org.jdom.Document class A lightweight object holding a DocType, ProcessingInstruction s, a root Element (containing other Element s), and Comment s A document can be constructed from scratch: Or it can be constructed from a file, stream, or URL: Then it can be output as XML, or SAX, or DOM: Document doc = new Document( new Element("root").setText("courseregister")); SAXBuilder builder = new SAXBuilder(); Document doc = builder.build(url); XMLOutputter outputter = new XMLOutputter(); outputter.output(doc, System.out);

Ensuring Well-Formedness The Element constructor (and all other object constructors) check to make sure the element is legal i.e. the name and content don't contain inappropriate characters The add and remove methods also check document structure An element may only exist at one point in the tree Only one value can be returned by getParent() No loops in the graph are allowed Exactly one root element must exist