翻訳と辞書
Words near each other
・ JDeveloper
・ JDF
・ JDG
・ JDHS
・ JDI
・ JDiff
・ JDiggz
・ Jdimir River
・ Jdiriya
・ JDK Enhancement Proposal
・ JDM
・ JDM Roitelet
・ JDN
・ JDO
・ JDO Media
JDOM
・ JDownloader
・ JDP
・ JDPR
・ JDQ training camp
・ JDR
・ JDRF
・ JDS
・ JDS Akebono (DE-201)
・ JDS Amagiri (DD-154)
・ JDS Amatsukaze
・ JDS Ashigara
・ JDS Atago
・ JDS Chōkai
・ JDS Harukaze (DD-101)


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

JDOM : ウィキペディア英語版
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. JDOM integrates with Document Object Model (DOM) and Simple API for XML (SAX), supports XPath and XSLT. It uses external parsers to build documents. JDOM was developed by Jason Hunter and Brett McLaughlin starting in March 2000. It has been part of the Java Community Process as JSR 102, though that effort has since been abandoned.
== Examples ==
Suppose the file "foo.xml" contains this XML document:







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.

In case you don't want to create the document object from any file or any input stream, you can create the document object against the element.

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"));


抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「JDOM」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.