I have an XML field in a file with more than 1 attribute. How do I print out both. My following code only prints one.. XML file : 0.52
Code:
public void startElement(String nameSpaceURI,
String localName,
String qName,
Attributes atts) {
int attributeLength = atts.getLength();
for (int i = 0; i < attributeLength; i++) {
String attrName = atts.getLocalName(i);
String attrVal = atts.getValue(i);
}
System.out.print("<" + qName + attrName + attrVal + ">");
}
Thanks for your help in advance !!
It will be compiled since it will have atleast one attribute value. However, I found the simple solution that I was looking for..
public void startElement(String nameSpaceURI, String localName, String qName, Attributes atts) {