Parsing (COunting Elements and Attributes)
Can anyone point me to the method sfor counting elements and attributes in a parsed XML document. For example, I have a XML document that contains a number of 'word' files, I need to produce a printout that gives the total number. The files have a size attribute and I need to calculate and printout the total size of all the files together
ChuckBing,
Thanks for the pointers. I now have the following method:
} public void startElement(String elementName, AttributeList al) throws SAXException
{
String attributeValue;
if (elementName.equals("PRICE"))
if(al.getLength()>0)
for(int j = 0;j<al.getLength();j++)
{
attributeValue = al.getValue(j);
System.out.println("Total Attribute value is " + attributeValue);
}
This obviously allows me to extract the detail from "PRICE" but "PRICE" actually has two attributes. I can't find another method that allows me to extract out the detail for a specific attribute.
Can you suggest anything?>