dcsimg
Linux Today: Linux News On Internet Time.




More on LinuxToday


EarthWeb: JDOM: XML Meets Java Meets Open Source

Jan 08, 2001, 21:36 (0 Talkback[s])
(Other stories by Piroz Mohseni)

WEBINAR:
On-Demand

Re-Imagining Linux Platforms to Meet the Needs of Cloud Service Providers


"JDOM takes an intuitive approach to modeling an XML document into a series of Java objects. These objects are then used like any other Java object to manipulate and modify an XML document."

"XML is an extensible framework for encapsulating data. Its widespread usage has depended to a large degree on how various programming languages could support reading, writing, and manipulating XML. Standards like DOM and SAX were developed early on and provide a language-independent API for XML manipulation. As the technology matures, issues such as performance, ease of use, and productivity become important. While many consider XML the universal language for data, there is no such thing as a universal programming language. Different languages have different capabilities and are optimized for certain tasks. While DOM and SAX continue to dominate the development world, new language-specific APIs are emerging. One such API is JDOM, an open source project whose goal is to make XML manipulation easier for Java programmers. This article is an introduction to JDOM."

"JDOM takes an intuitive approach to XML manipulation. All XML building blocks (node types) are represented in JDOM as a class. For example, an element, an attribute, or a processing instruction, all have a corresponding class in JDOM. Using an underlying SAX or DOM parser, an XML document is parsed and represented as a Document object. The root element of the Document object is your key to gaining access to the rest of the XML document. Since Java naturally supports object inheritance, you are able to navigate the object hierarchy representing your XML document and extract the information you want. There is no event model to follow or DOM tree nodes to traverse. Your interaction with the XML document is done via Java objects (something that is very familiar to Java programmers)."

Complete Story

Related Stories: