Originally posted by Gurpreet Saini:
I have xml file please tell me the code to get the name of XML file name using SAX parser.
You can't. First of all, the SAX parser doesn't have to be parsing data from a file. Or even from a URL. It could be parsing data from a
String variable. And second, the parser doesn't know what it's parsing until you call its parse() method.
How can I get the attributes of xml file using SAX parser without hardcoding them.
When the parser calls your startElement() method, the fourth parameter is a reference to an Attributes object. That's where you get the attributes from. You don't need to hard-code anything.