Package solution
Class XMLParser
java.lang.Object
solution.XMLParser
Utility class for parsing an XML file.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Employee
parseEmployee
(Scanner scanner) Reads the data in an Employee section and uses it to create and return a new Employee object.
-
Constructor Details
-
XMLParser
public XMLParser()
-
-
Method Details
-
parseEmployee
public static Employee parseEmployee(Scanner scanner) throws IllegalArgumentException, NumberFormatException Reads the data in an Employee section and uses it to create and return a new Employee object.- Parameters:
scanner
- Scanner object positioned at the start of a nested employee element.- Returns:
- New Employee object created from the information in a nested employee element.
- Throws:
IllegalArgumentException
- if any of the tags needed to create an Employee are missing. This should be thrown by the constructor by the Employee subclasses.NumberFormatException
- if any number values can not be parsed correctly.
-