import java.util.Iterator;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.input.SAXBuilder;
public class MainClass {
public static void main(String[] args) throws Exception {
Document doc = new SAXBuilder().build("books.xml");
Element books = doc.getRootElement();
Iterator it = books.getChildren().iterator();
while (it.hasNext()) {
Element book = (Element) it.next();
System.out.println(book.getChildText("name") + " was published in "
+ book.getChildText("pubDate"));
}
}
}
sources68 the directory containing the programming examples, source code and programming guide online
Monday, 1 August 2011
Use SAXBuilder from JDOM
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment