I'm using SAX Parser to convert XML into CSV format. Here, I need to fetch the root element of any given XML file. I know that I can do the task by using the following snippet.
if (!"book".equalsIgnoreCase(qName)) {
.......
}
But I want to fetch the root element name from any given XML file automatically instead of explicitly defining it as "book". Because my intention is to generate CSV from any input XML file but with only using the SAX Parser. Can anyone help me with my problem? Thanks in advance!