Same deal as the last lab, go ahead and pull the code and import it into eclipse
This lab has a few errors in it, just like the one before it, we will have to fix that!
The goal of this lab is to show understanding of string manipulation and XML
We will only be editing the ParseTokens.java for this lab
If you look at the ParseTokens class you will see 3 empty methods and a method called parseTokens. For this lab we will just be filling in the 3 methods that are empty.
The three methods are getToken, isCloseTag, and isOpenTag
These methods are all pretty self explanitory, but I will run through what each should do
getToken should print out whatever is inside the angle brackets for the XML tags. If you open up the zin file you will see a book tag, this line is an open tag and will be returned as book. We also need to handle close tags in this method, which have a forward slash in the front. Thinking about these 2 cases we can determine that we need to take the input string and strip off the angle brackets, and if there is a forward slash we will strip it off as well. We can do this using java's substring method.
The next 2 methods are essentially the same. We need to determine whether the input string is an open tag or a close tag.
For the isCloseTag method you will check if the input string begins with a angle bracket and a forward slash and ends with a closing angle bracket. For isOpenTag you will check if it begins and ends with angle brackets. Don't forget to check if the string is long enough for the check or you will get some OutOfBounds exceptions for substring!
If everything is done it should work now! Run it and compare zlog with the output shown in the console!
Zip up the folder and submit to dropbox!