encyclopegia.org

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.[src] JDOM integrates with Document Object Model (DOM) and Simple API for XML (SAX), supports XPath and XSLT.[src] It uses external parsers to build documents.[src] JDOM was developed by Jason Hunter and Brett McLaughlin starting in March 2000.[src] It has been part of the Java Community Process as JSR 102, though that effort has since been abandoned.[src]

]] ]] 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.[src] JDOM integrates with Document Object Model (DOM) and Simple API for XML (SAX), supports XPath and XSLT.[src] It uses external parsers to build documents.[src] JDOM was developed by Jason Hunter and Brett McLaughlin starting in March 2000.[src] It has been part of the Java Community Process as JSR 102, though that effort has since been abandoned.[src] One can parse the XML file into a tree of Java objects with JDOM, like so: SAXBuilder builder = new SAXBuilder(); Document doc = builder.build(new FileInputStream("foo.xml")); Element root = 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.[src] 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.[src] Element root = new Element("shop"); // here is the root Document doc = new Document(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: Element root = new Element("shop"); root.setAttribute("name", "shop for geeks"); root.setAttribute("location", "Tokyo, Japan"); Element item1 = new Element("computer"); item1.setAttribute("name", "iBook"); item1.setAttribute("price", "1200$"); root.addContent(item1); // perform similar steps for other elements XMLOutputter outputter = new XMLOutputter(); outputter.output(new Document(root), new FileOutputStream ("foo2.xml")); ==References==[src]

13 sentences · 13 cited inline · 0 references stored

References

No reference rows published for this article.

Cite this article

MLA

"JDOM." encyclopegia.org, 2026, https://encyclopegia.org/wiki/jdom. Accessed 26 November 2026.

Chicago

"JDOM." encyclopegia.org. Accessed November 26, 2026. https://encyclopegia.org/wiki/jdom.

APA

encyclopegia.org. (2026). JDOM. Retrieved November 26, 2026, from https://encyclopegia.org/wiki/jdom

Accessed November 26, 2026 · CC BY-SA 4.0 · citation page · JSON

CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1365925038 · 0.5 · snapshot enwiki-001365925038

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.