[jdom-interest] reading XML

Eugen Kozynin ekozynin at interserv.com.au
Mon Dec 4 22:38:01 PST 2000


Hi!

I've used XMLOutputter to write down XML file on hard drive. This works
fine.
But now I want to read that file back to memory & make some modifications.
I try to do the following:

import org.jdom.*;
import org.jdom.input.*;
import org.jdom.output.*;
import java.util.*;
import java.io.*;

public class Test {
   public static void main(String[] args) {
      try {
         SAXBuilder b = new SAXBuilder();
         Document doc = b.build(new File("product.xml"));

         // Output as XML to screen
         XMLOutputter outputter = new XMLOutputter();
         outputter.output(doc, System.out);
       } catch (Exception e) {
         e.printStackTrace();
       }
   }
}

This code compiles fine but throws following exception:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/xml/sax/SAXNotRec
ognizedException
Any ideas why this may happen?

Also, probably there is also some other ways to get XML file back?

Thank you
Eugen




More information about the jdom-interest mailing list