The second application for the Victorian Open Range Animal Reserve will convert data from a CSV (Comma-Separated Values) format to an XML (eXtensible Markup Language) format.
The Reserve often accepts various animals from smaller sanctuaries overseas and interstate. The data on the new animals usually arrives in the form of a CSV file with a common format as in Figure 2.1. You will be provided with this file.
Unfortunately, the Reserve’s system requires an XML file, formatted as in Figure 2.2.
Note
· The Reserve’s XML file uses the term “species”, while the common CSV input file uses the term “kind” for the same purpose.
· Some animals do not have names. In the XML file, the name attribute should be excluded for those animals.
· Some addresses lack a state or province (e.g. NSW). In the XML file, the state_or_province attribute should be excluded for those addresses.
· Up to 2 recent ranger notes (with dates) are included for each animal. In the XML file, the notes element should include one or 2 note entities as appropriate, or should be excluded if there are no notes.
1. Read animal data from an input CSV file (input.csv), represented as a spreadsheet table in Figure 2.1. The file is assumed to be in the same folder as your application.
2. Store the animal data in an appropriate data structure, such as a list of records.
3. Allow the user to visually verify that the CSV data has been loaded correctly.
4. Write the data into an output XML file (output.xml) in the format as described in Figure 2.2.
5. This application requires a Graphical User Interface (GUI). Working with the Reserve staff, you have a mock-up of the desired GUI. See Figure 2.3.
· Usability – the application should communicate appropriately to the user when a task has succeeded.
· Robustness – the application should offer appropriate feedback if a system IO error occurred, such as the input file not being found. Avoid crashing.
· Your teacher will provide the input CSV file (input.csv). Due to time constraints, you do not need to validate every value in the input data. The contents of input.csv can be assumed to be correct. Some values may benefit from existence checks when deciding on the output XML.
· Your teacher might provide an XML schema to allow you to validate your output file.
· You might find it easier to write this application without a GUI, then add the GUI later.
· Processes, such as writing the output file, should be written as functions.
· All functions should be documented using a standard documentation convention, as well as comments where appropriate.