JDOM, The Java DOM (2/4) - exploring XML | WebReference

JDOM, The Java DOM (2/4) - exploring XML

JDOM, The Java DOM

DOM and JDOM head-to-head

JDOM presents an XML tree as Elements and Attributes, the more generic Node interface is factored out in common base classes. NodeMaps are implemented as java.util.HashTable, and NodeIterator is replaced with java.util.Iterator. An inheritance tree of exceptions replaces the generic DOMException:
DOM InterfaceJDOM Class
AttrAttribute
CDATASectionCharacterData
CommentComment
DocumentDocument
DocumentFragment
DocumentTypeDocType
DOMImplementation
ElementElement
EntityEntity
EntityReference
NamedNodeMap
Node
NodeList
Notation
ProcessingInstructionProcessingInstruction
Textjava.lang.String
Verifier
DOMExceptionJDOMException, IllegalAddException, IllegalDataException, IllegalNameException., IllegalTargetException

JDOM is grouped in four packages:

org.jdom
the classes that represent an XML document and its parts: Attribute, Comment, DocType, Document, Element, Entity, ProcessingInstruction, plus Verifier and assorted exceptions.
org.jdom.input
classes for reading a document into memory: DOMBuilder, SAXBuilder
org.jdom.output
classes for writing a document onto a stream or other target (e.g. SAX or DOM application): XMLOutputter, SAXOutputter, DOMOutputter
org.jdom.adapters
classes for hooking up DOM implementations: AbstractDOMAdapter, OracleV1DOMAdapter, OracleV2DOMAdapter, ProjectXDOMAdapter, XercesDOMAdapter, XercesDOMAdapter

Reading and Writing XML Documents with JDOM

JDOM is for both input and output, new documents can be read from a stream or constructed in memory. An org.jdom.output.XMLOutputter sends a document from memory to an OutputStream or Writer. A JDOM document can also be sent to a SAX ContentHandler or DOM org.w3c.dom.Document for further processing with a different API. JDOM can connect to any parser that supports SAX or DOM compatible parser including:

Another major effort in the Java-specific XML space is the JSR-000031 XML Data Binding Specification from Bluestone, Sun, WebMethods et al. The proposed specification will define an XML data-binding facility for the JavaTM Platform. Such a facility compiles an XML schema into one or more Java classes. These automatically-generated classes handle the translation between XML documents that follow the schema and interrelated instances of the derived classes. They also ensure that the constraints expressed in the schema are maintained as instances of the classes are manipulated.

Comparing the SAX, DOM and JDOM ways...

https://www.internet.com

Produced by Michael Claßen
All Rights Reserved. Legal Notices.

URL: https://www.webreference.com/xml/column25/2.html
Created: Dec 03, 2000
Revised: Dec 03, 2000