Hi,

I am very new to Java and need some help with some errors I get trying to run a java bean. The code is below which will be used to for a web application to manage a list of products held in an XML file. It uses JDOM. The bean contains a create, update and delete method and a method to build the document tree. Based on the example / tutorial "Java and JDOM: the perfect couple"

The errors I get are as follows:

C:\Tomcat 5.5\webapps\ROOT\XMLEdit>javac CATALOGManager.java
CATALOGManager.java:70: cannot find symbol
symbol : variable PRODUCT
location: class XMLEdit.CATALOGManager
PRODUCT.sort(PRODUCT, new sortname());
^
CATALOGManager.java:70: cannot find symbol
symbol : class sortname
location: class XMLEdit.CATALOGManager
PRODUCT.sort(PRODUCT, new sortname());
^
CATALOGManager.java:70: cannot find symbol
symbol : variable PRODUCT
location: class XMLEdit.CATALOGManager
PRODUCT.sort(PRODUCT, new sortname());
^
CATALOGManager.java:74: cannot find symbol
symbol : constructor XMLOutputter(java.lang.String,boolean)
location: class org.jdom.output.XMLOutputter
XMLOutputter outputter = new XMLOutputter(" ",true);
^
CATALOGManager.java:76: cannot find symbol
symbol : method setTextNormalize(boolean)
location: class org.jdom.output.XMLOutputter
outputter.setTextNormalize(true);
^
Note: CATALOGManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
5 errors



package XMLEdit;

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

public class CATALOGManager {

Document doc; // JDOM document
List products; // List of Elements
int index = -1; // index for current Element in "catalogue"

public void buildDocument(String filename) {
try {
SAXBuilder builder = new SAXBuilder();
doc = builder.build(filename);
products = doc.getRootElement().getChildren();
} catch (JDOMException e) {
e.printStackTrace();
}
}

public void setIndex(int i) {
index = i;
}

public int getNumberOfProducts() {
return products.size();
}

public String getId() {
Element product = (Element)products.get(index);
return product.getAttributeValue("id");
}

public String getname() {
Element product = (Element)products.get(index);
return product.getChildText("name");
}

public String getprice() {
Element product = (Element)products.get(index);
return product.getChildText("price");
}


public void updatePRODUCT(String id, String name, String price) {
Element product = (Element)products.get(index);
product.getAttribute("id").setValue(id);
product.getChild("name").setText(name);
product.getChild("price").setText(price);
}

public void deletePRODUCT() {
products.remove(index);
}

public void createPRODUCT(String id, String name, String price) {
Element product = new Element("product");
product.setAttribute(new Attribute("id", id));
product.addContent(new Element("name").setText(name));
product.addContent(new Element("price").setText(price));

products.add(product);
}

public void sort() {
PRODUCT.sort(PRODUCT, new sortname());
}

public void save(String filename) {
XMLOutputter outputter = new XMLOutputter(" ",true);
try {
outputter.setTextNormalize(true);
FileWriter f = new FileWriter(new File(filename));
outputter.output(doc, f);
f.close();
} catch (IOException e) {
e.printStackTrace();
}
}

public static void main(String[] args) {
CATALOGManager d = new CATALOGManager();
d.buildDocument(args[0]);
//d.updatePRODUCT("New NAME", "123");
//d.createPRODUCT("New NAME2", "1234");
//d.deletePRODUCT(0);
//d.deletePRODUCT(0);
//d.deletePRODUCT(0);
//d.createPRODUCT("New NAME", "123");
//d.updatePRODUCT(0, "Next NAME", "7913");
//d.deletePRODUCT(0);
//d.outList();
d.sort();
for (int i = 0; i < d.products.size(); i++) {
d.setIndex(i);
System.out.println(d.getname() + "/" + d.getprice());
}
}

private void outList() {
XMLOutputter outputter = new XMLOutputter();
try {
outputter.output(doc, System.out);
} catch (IOException e) {
e.printStackTrace();
}
}

}

I cant see what I have done wrong any Help greatly appreciated..