ParseTags pseudo code
*Read in file. Begin parsing *Set current tag level to 0. *Set level to 1 *for each tag{ if(the tag contains )(opening tag){ Set temp to 1 Print opening tag Add temp and current word into hash map Increment temp variable by one } else if(the tag contains )(closing tag){ Decrement temp by one Print closing tag if(the tag is empty){ Exit Increment level by 1 continue process until the end of the file } } } *Display Hashmap contents
Please note that using a a parser like Xerces is not acceptable. You can either
Describe the algorithm, write pseudo code or optionally implement the solution.
Describe how to implement a simple parser that does well-formedness checking on XML, such as the following:
x
y
z.