JDOM
Intro to JDOM
Where we're going
Prerequisites
A simple example
Document Type Definition
Trees
Processing XML with Java is easy
What is JDOM?
About JDOM
Four packages:
The org.jdom package
The org.jdom.input package
The org.jdom.output package
The org.jdom.adapters package
Part II: Writing XML Documents with JDOM
A JDOM program that writes this XML document
Hello JDOM
Actual Output
Hello DOM
A Java program that writes Fibonacci numbers into a text file
fibonacci.txt
fibonacci.xml
A JDOM program that writes Fibonacci numbers into an XML file
A DOM program that writes Fibonacci numbers into an XML file
Changing Encoding
Suppose you want to include a DTD
ValidFibonacci
valid_fibonacci.xml
Converting data to XML
Sample Tab Delimited Data: Baseball Statistics
A Program to convert tab delimited data to XML
Baseball Stats in XML
A Shortcut
Converting data to XML while Processing it
Batting Averages in XML
Advantages of JDOM for Writing Documents
Part III: Parser APIs
Parser APIs
JDOM Comaptible Parsers for Java
SAX
SAX2
The SAX Process
Making an XMLReader
Parsing a Document with XMLReader
Event Based API Caveats
Document Object Model
The Design of the DOM API
DOM Evolution
Eight Modules:
DOM Trees
org.w3c.dom
The DOM Process
Parsing documents with a DOM Parser Example
The JDOM Process
Parsing a Document with JDOM
Parser Results
Turning on Validation in JDOM
JDOM Validator
Validation Output
Building with DOM instead of SAX
DOMBuilder Example
Part IV: Reading XML Documents
UserLand's RSS based list of Web logs
Goal: Return a list of all the URLs in this list as java.net.URL objects
The SAX ContentHandler interface
SAX Design
User Interface Class
ContentHandler Class
Weblogs Output
Weblogs with DOM
DOM Design
The Node Interface
The NodeIterator Interface
The NodeFilter Interface
Weblogs with DOM
Weblogs Output
Weblogs with JDOM
JDOM Design
Weblogs with JDOM
Weblogs Output
Part V: The org.jdom Package
The Document Node
The Document Class
Document Example
Output from XMLPrinter
Element Nodes
Element Class Implementation
The Element Class
Element Example: XCount
XCount Output
Handling Attributes in JDOM
The Attribute Class
IDTagger
Before IDTagger
After IDTagger
Handling Entities in JDOM
The Entity Class
Handling Comments in JDOM
Comment Nodes
The Comment Class
Comment Example
CommentReader Output
Handling Processing Instructions in JDOM
ProcessingInstruction Nodes
The ProcessingInstruction Class
XLinkSpider that Respects the robots Processing Instruction
Handling Namespaces
The Namespace Class
The Namespace Class
DocumentType Nodes
The DocType class
Example of the DocType Class
XHTMLValidator
Using the XHTMLValidator
JDOMException
JDOMException Class
Part V: The org.jdom.output Package
Serialization
XMLOutputter
Using the XMLOutputter Class Directly
Using the XMLOutputter Class Indirectly
JDOM based TagStripper
Output from a JDOM based TagStripper
Talking to DOM Programs
Talking to SAX Programs
Part VI: The org.jdom.input package
SAXBuilder
DOMBuilder
What JDOM doesn't do
To Learn More
Questions?
Start
|
Cafe con Leche
Copyright 2000
Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified June 25, 2000