This article contains instructions, advice, or how-to content .(May 2011) |
Stable release | 2.0.6.1 / December 9, 2021 |
---|---|
Repository | |
Written in | Java |
Operating system | Cross-platform |
Type | XML binding |
License | Similar to Apache License |
Website | jdom |
JDOM is an open-source Java-based document object model for XML that was designed specifically for the Java platform so that it can take advantage of its language features. [1] JDOM integrates with Document Object Model (DOM) and Simple API for XML (SAX), supports XPath and XSLT. [2] It uses external parsers to build documents. JDOM was developed by Jason Hunter and Brett McLaughlin starting in March 2000. [3] It has been part of the Java Community Process as JSR 102, though that effort has since been abandoned. [4]
Suppose the file "foo.xml" contains this XML document:
<shopname="shop for geeks"location="Tokyo, Japan"><computername="iBook"price="1200$"/><comic_bookname="Dragon Ball vol 1"price="9$"/><geekyness_of_shopprice="priceless"/></shop>
One can parse the XML file into a tree of Java objects with JDOM, like so:
SAXBuilderbuilder=newSAXBuilder();Documentdoc=builder.build(newFileInputStream("foo.xml"));Elementroot=doc.getRootElement();// root.getName() is "shop"// root.getAttributeValue("name") is "shop for geeks"// root.getAttributeValue("location") is "Tokyo, Japan"// root.getChildren() is a java.util.List object that contains 3 Element objects.
In case you do not want to create the document object from any file or any input stream, you can create the document object against the element.
Elementroot=newElement("shop");// here <shop></shop> is the rootDocumentdoc=newDocument(root);// create a new document with the supplied element as the root
As a converse, one can construct a tree of elements, then generate an XML file from it, as in the following example:
Elementroot=newElement("shop");root.setAttribute("name","shop for geeks");root.setAttribute("location","Tokyo, Japan");Elementitem1=newElement("computer");item1.setAttribute("name","iBook");item1.setAttribute("price","1200$");root.addContent(item1);// perform similar steps for other elementsXMLOutputteroutputter=newXMLOutputter();outputter.output(newDocument(root),newFileOutputStream("foo2.xml"));
A document type definition (DTD) is a specification file that contains set of markup declarations that define a document type for an SGML-family markup language. The DTD specification file can be used to validate documents.
The Document Object Model (DOM) is a cross-platform and language-independent interface that treats an HTML or XML document as a tree structure wherein each node is an object representing a part of the document. The DOM represents a document with a logical tree. Each branch of the tree ends in a node, and each node contains objects. DOM methods allow programmatic access to the tree; with them one can change the structure, style or content of a document. Nodes can have event handlers attached to them. Once an event is triggered, the event handlers get executed.
In computing, a namespace is a set of signs (names) that are used to identify and refer to objects of various kinds. A namespace ensures that all of a given set of objects have unique names so that they can be easily identified.
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. The World Wide Web Consortium's XML 1.0 Specification of 1998 and several other related specifications—all of them free open standards—define XML.
XSLT is a language originally designed for transforming XML documents into other XML documents, or other formats such as HTML for web pages, plain text or XSL Formatting Objects, which may subsequently be converted to other formats, such as PDF, PostScript and PNG. Support for JSON and plain-text transformation was added in later updates to the XSLT 1.0 specification.
Java Platform, Standard Edition is a computing platform for development and deployment of portable code for desktop and server environments. Java SE was formerly known as Java 2 Platform, Standard Edition (J2SE).
Jakarta Server Pages is a collection of technologies that helps software developers create dynamically generated web pages based on HTML, XML, SOAP, or other document types. Released in 1999 by Sun Microsystems, JSP is similar to PHP and ASP, but uses the Java programming language.
In computing, the Java API for XML Processing (JAXP), one of the Java XML application programming interfaces (APIs), provides the capability of validating and parsing XML documents. It has three basic parsing interfaces:
SAX is an event-driven online algorithm for lexing and parsing XML documents, with an API developed by the XML-DEV mailing list. SAX provides a mechanism for reading data from an XML document that is an alternative to that provided by the Document Object Model (DOM). Where the DOM operates on the document as a whole—building the full abstract syntax tree of an XML document for convenience of the user—SAX parsers operate on each piece of the XML document sequentially, issuing parsing events while making a single pass through the input stream.
An HTML element is a type of HTML document component, one of several types of HTML nodes. The first used version of HTML was written by Tim Berners-Lee in 1993 and there have since been many versions of HTML. The current de facto standard is governed by the industry group WHATWG and is known as the HTML Living Standard.
Jakarta XML Binding is a software framework that allows Java EE developers to map Java classes to XML representations. JAXB provides two main features: the ability to marshal Java objects into XML and the inverse, i.e. to unmarshal XML back into Java objects. In other words, JAXB allows storing and retrieving data in memory in any XML format, without the need to implement a specific set of XML loading and saving routines for the program's class structure. It is similar to xsd.exe
and XmlSerializer
in the .NET Framework.
The term CDATA, meaning character data, is used for distinct, but related, purposes in the markup languages SGML and XML. The term indicates that a certain portion of the document is general character data, rather than non-character data or character data with a more specific, limited structure.
Streaming API for XML (StAX) is an application programming interface (API) to read and write XML documents, originating from the Java programming language community.
OmniMark is a fourth-generation programming language used mostly in the publishing industry. It is currently a proprietary software product of Stilo International. As of July 2022, the most recent release of OmniMark was 11.0.
XMLBeans is a Java-to-XML binding framework which is part of the Apache Software Foundation XML project.
The Oxygen XML Editor is a multi-platform XML editor, XSLT/XQuery debugger and profiler with Unicode support. It is a Java application so it can run in Windows, Mac OS X, and Linux. It also has a version that can run as an Eclipse plugin.
In computer science, marshalling or marshaling is the process of transforming the memory representation of an object into a data format suitable for storage or transmission, especially between different runtimes. It is typically used when data must be moved between different parts of a computer program or from one program to another.
XQuery API for Java (XQJ) refers to the common Java API for the W3C XQuery 1.0 specification.
LibSBML is an open-source software library that provides an application programming interface (API) for the SBML format. The libSBML library can be embedded in a software application or used in a web servlet as part of the application or servlet's implementation of support for reading, writing, and manipulating SBML documents and data streams. The core of libSBML is written in ISO standard C++; the library provides API for many programming languages via interfaces generated with the help of SWIG.
Castor is a data binding framework for Java with some features like Java to Java-to-XML binding, Java-to-SQL persistence, paths between Java objects, XML documents, relational tables, etc. Castor is one of the oldest data binding projects.