[jdom-interest] Beta 5: SaxBuilder constructor crashes Hunter & McLaughlin's code

Michael F. Baker mfbaker at home.com
Mon Sep 25 16:46:47 PDT 2000


I just downloaded JDOM beta 5, and the SaxBuilder constructor line below
crashes the application.  Anyone have any ideas?
Thanks!
- Mike

// This is code from the article "Easy Java/XML integration with JDOM, Part
1"
import java.io.*;
import org.jdom.*;
import org.jdom.input.*;
import org.jdom.output.*;

public class PrettyPrinter {
   public static void main(String[] args) {
        // Assume filename argument
        String filename = args[0];

        try {
            // Build the document with SAX and Xerces, no validation
            SAXBuilder builder = new SAXBuilder();  // CRASHES app!!
            // Create the document
            Document doc = builder.build(new File(filename));

            // Output the document, use standard formatter
            XMLOutputter fmt = new XMLOutputter();
            fmt.output(doc, System.out);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}




More information about the jdom-interest mailing list