Thanks Ulf.
I have a class called ParseXMLFile.
The ParseXMLFile class has three member variables:
public static Vector elementVector = new Vector();
public static
String fileToParse;
public static String searchElement;
there is also a method called:
public static Vector parseFileForElement(String filename, String element)
This method is called from some external class that needs the information from the XML file.
The method sets the two class member variables and instantiates the parser, setting up the content handler and the error handler.
The startElement method of the content handler simply checks to see if localName is the element we are looking for:
if (localName.equals(ParseXMLFile.searchElement))
{
ParseXMLFile.elementVector.addElement(atts);
}
If it is correct, then it will add the elements to the vector. Once the parsing is complete, the parseFileForElement method will return the Vector back to the class that called it.
As I mentioned, I did insert some general debug code to check that the search element was correctly encountered and that the attributes matched what they should have been in the xml file. However, the vector is getting bad data and it only has the attributes which come from whatever the last element of the XML file contains, regardless of the name of that element.
I hope my explanation makes sense.
Rob