JDOMCreateExample.java Source code

Java tutorial

Introduction

Here is the source code for JDOMCreateExample.java

Source

import java.io.FileInputStream;
import java.io.IOException;
import java.io.FileNotFoundException;
import org.jdom.Document;
import org.jdom.JDOMException;
import org.jdom.adapters.XercesDOMAdapter;
import org.jdom.input.DOMBuilder;
import org.jdom.output.XMLOutputter;

public class JDOMCreateExample {

    private static DOMBuilder builder = null;

    public static void main(String args[]) throws IOException, FileNotFoundException {

        XercesDOMAdapter xercAdapter = new XercesDOMAdapter();
        org.w3c.dom.Document w3Dom = xercAdapter.getDocument(new FileInputStream("games.xml"), false);

        builder = new DOMBuilder("org.jdom.adapters.XercesDOMAdapter");

        Document doc = builder.build(w3Dom);
    }
}