How can i display node names with the maximum depth in the tree with SAX.
The algorithm would be fine for me to understand the concept..
For example what should i do with startelement, endelement, startdocument, enddocument methods and what variables do i need to perform the task?
Thank you!
This is more of an algorithmic problem. The thing to note in order to solve the problem is that each time you have a startelement event you have gone one level down and when you have an endelement event you have gone one level up. The idea is to have a variable (level) and for each startelement increase it (level++) and for each endelement decrease it (level–). This means that when find the endelement for a node the value of level variable would be the depth of the node. Then the only thing you have to do is just keep track of the max. A pseudocode version will be like this:
Hope it helps.