I was working on one of the Xerces tutorials on this site. I tested one of the code pieces on an xml file, and got the following error:
java.lang.NoClassDefFoundError org/xml/sax/SAXNotSupportedException.
It compiled no problem, but apparently this error means that "The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found." I have installed all the xerces files and have set the classpath to my bin with all those files in it. How can it find the class def to compile, but not find it to run? And why is it giving me a sax error when I am using the dom? Very strange...Has anybody who tried the Xerces tutorials encountered this problem? Thanks in advance for your help.

import org.apache.xerces.parsers.DOMParser;
import org.w3c.dom.*;
import java.io.*;

public class MyThirdDomApp {

// a counter for keeping track of the "tabs"
private int TabCounter = 0;

// constructor
public MyThirdDomApp (String xmlFile) {

// create a Xerces DOM parser
DOMParser parser = new DOMParser();

// parse the document and
// access the root node with its children
try {
Document document = parser.getDocument();
} catch (Exception e) {
System.err.println (e);

// this is a recursive function to traverse the document tree
private void NodeDetails (Node node) {
String Content = "";
int type = node.getNodeType();

// check if element
if (type == Node.ELEMENT_NODE) {
System.out.println ("Element: " + node.getNodeName() );

// check if the element has any attributes
if(node.hasAttributes()) {

// if it does, store it in a NamedNodeMap object
NamedNodeMap AttributesList = node.getAttributes();
// iterate through the NamedNodeMap and get the attribute names and values
for(int j = 0; j < AttributesList.getLength(); j++) {
System.out.println("Attribute: " +
AttributesList.item(j).getNodeName() + " = " +
} else if (type == Node.TEXT_NODE) {

// check if text node and print value
Content = node.getNodeValue();

if (!Content.trim().equals("")){
System.out.println ("Character data: " + Content);
} else if (type == Node.COMMENT_NODE) {
// check if comment node and print value
Content = node.getNodeValue();
if (!Content.trim().equals("")){
System.out.println ("Comment: " + Content);

// check if current node has any children
NodeList children = node.getChildNodes();
if (children != null) {
// if it does, iterate through the collection
for (int i=0; i< children.getLength(); i++) {
// recursively call function to proceed to next level

// this formats the output for the generated tree
private void FormatTree (int TabCounter) {
for(int j = 1; j < TabCounter; j++) {

// the main method to create an instance of our DOM application
public static void main (String[] args) {
MyThirdDomApp MyThirdDomApp = new MyThirdDomApp ("SomeFile.xml");