Now I want to take blocks of that code as in take teacher out and process, then the students and process like below:
Now for my parser I can just search for the tags, however, if I search for name then I would get many results. Need to do this as fast as possible for my Java server. What is the best way to extract this Tags and all? Reason is I don't want just the results as I may want to do further reading
I don't think I want to use XPath as I realised that I will have to create a query and this would not work for me.
This is more what my xml would look like
I want the see the student block and then read the node title and extract the node student then read the information in it and each node value will be a case which I can switch to and run the function that belongs to it.
and the only difference that I want to do (as I think you already understand) is that I would like to see in this xml is to read the nodes in one by one and depending on the tag preform an action instead of in the example actually searching for the node (in the example shown they search for person)
I would suggest you spend some time learning about XML before you proceed. Right now it appears you have made up your own terminology for things, which is going to make it hard for you to understand documentation and tutorials for a start.
For example I think what you are calling a "block" is what XML calls an "element". What you mean by "node title", I can't tell. At any rate the terminology is there for a reason, namely so we're all using the same words for things. Having to struggle through other people's words is just painful. I suggest Processing XML with Java as a good starting point, and the second chapter describes terminology.
and the only difference that I want to do (as I think you already understand) is that I would like to read each of the child elements tags and then depending on the tag data perform a task. I would like to work my way down the XML file then searching for specific tags instead of in the example actually searchs for the element (in the example shown they search for person).
I hope this reads better. I will read the document, however, I need to finish this project quickly as have been extremely slack over Christmas. Thanks
Okay. So you want to use DOM processing to go through your document. But I don't understand your problem. You say you don't want to search for particular element names, you just want to read all of the elements and do some processing for each element based on its name, or something along that line. So what's your problem with that?
(By the way DOM doesn't give you access to the "tags". You only see start and end tags in the text version of the document. DOM restructures the document into a tree consisting of nodes.)
You're navigating through a tree. You start with the document element and process its child nodes. If necessary, you process the children of those child nodes, and so on. I'm sure the link I posted has examples of how to do DOM navigation, and I'm sure there are more examples on the web than just that one example you looked at.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com