So I'm currently in the middle of developing a program that parses through any XML file and returns data from it in the exact order it's in. The problem I have however is that the program must be able to handle different XML files (i.e. having different elements, different structure etc). I've been able to do this using DOM as I can just make a recursive method that loops through the tree and returns the values of the nodes, but it's not the most efficient way given the size of my XML files. So instead I'm interested in using SAX Parser, however as I'm sure you're aware of, it not as easy to use as it doesn't generate a data structure in which the information can be contained in. It may seem like a silly question (only recently learned programming), but does anyone have any examples or suggestions as to how I can go about overcoming this?
Also having a look at StAX which seems to be the better way of going!
Thanks