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 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

• JDOM should integrate with DOM and SAX
– Support reading and writing DOM documents and SAX events
– Support runtime plug-in of any DOM or SAX parser
– Easy conversion from DOM/SAX to JDOM
– Easy conversion from JDOM to DOM/SAX


• JDOM should stay current with the latest XML standards
– DOM Level 2, SAX 2.0, XML Schema


• JDOM does not need to solve every problem
– It should solve 80% of the problems with 20% of the effort
– We think we got the ratios to 90% / 10%

JDOM consists of five packages

 

image

 

The org.jdom.input Package


• Classes for reading XML from existing sources:
– DOMBuilder
– SAXBuilder
• Also, outside contributions in jdom-contrib:
– ResultSetBuilder
– SpitfireBuilder
• New support for JAXP-based input
– Allows consistency across applications
– Builders pick up JAXP information and user automatically
– Sets stage for JAXP version.next

 

The org.jdom.output Package


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

 

org.jdom.transform

• TRaX is now supported in org.jdom.transform
– Supports XSLT transformations
– Defines Source and Result interfaces
– JDOMSource
– JDOMResult

 

General Program Flow


• Normally XML Document -> SAXBuilder ->XMLOutputter

image




完整的pdf下载地址,JDOM: How It Works,and How It Opened the Java Processby Jason Hunter

http://www.blogjava.net/Files/cherishchen/JDOM%20How%20It%20Works.zip