Question: I need help with a Java problem please: Create a package called parseXML . Copy into it the reference class XMLToken provided for you below.
I need help with a Java problem please:
Create a package called parseXML. Copy into it the reference class XMLToken provided for you below. Create in it a program class called ParseXML.


Your ParseXML program prompts the user for the name of a file and then redirects StdIn to that file, as in the previous assignment. It will print to standard output (using StdOut) each token on its own line. While doing this it will also use the algorithm appearing below to parse the file to see whether it is properly structured by the rules mentioned above. If not, it should throw one of three possible exceptions. You will find the exception classes provided for you below.

XMLToken.java:
package parseXML;
public class XMLToken { private String token; public XMLToken(String token) { this.token=token; } public boolean isTag() { if(token.length()>=3){ if(token.charAt(0)=='') return true;; } return false; } public boolean isOpeningTag() { if(isTag()) { if(token.charAt(1)!='/') return true; } return false; } public boolean isClosingTag() { if(isTag()) { if(token.charAt(1)=='/') return true; } return false; }
public String getTagName() { if(isTag()) { if(isClosingTag()) return token.substring(2,token.length()-1); else return token.substring(1,token.length()-1); } return ""; }
}
Exception classes:
ParseXMLImproperlyNestedTagsException.java:
package parseXML;
public class ParseXMLImproperlyNestedTagsException extends RuntimeException { public ParseXMLImproperlyNestedTagsException(String message) { super(message); } }
ParseXMLMissingClosingTagException.java:
package parseXML;
public class ParseXMLMissingClosingTagException extends RuntimeException { public ParseXMLMissingClosingTagException(String message) { super(message); } }
ParseXMLMissingOpeningTagException.java:
package parseXML;
public class ParseXMLMissingOpeningTagException extends RuntimeException {
public ParseXMLMissingOpeningTagException(String message) { super(message); }
}
Specifications Syntactically correct XML A properly formed XML document is one where: Every token is either a tag or a word. The syntax of a tag is described in a previous assignment. Anything that is not a tag is a word. Every opening tag is followed at some point by a closing tag with the same tag name. Opening and closing tags are properly nested. For example, assume the following tags appear in the document:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
