Following this tutorial I was able to create an XML file and following this tutorial I was able to parse the XML file
I now want know how to check if the xml is a valid format before adding another Staff, if the xml is malformed it will exit out and give an error that it can't parse.
If it parses a gibberish file such as this, it will exit and not continue
asdsadasfsadf
If it parses a valid XML but not in the correct format, it will exit also (the first node is root instead of company)
<root>
<staff id="1001">
<firstname>yong</firstname>
<lastname>mook kim</lastname>
<nickname>mkyong</nickname>
<salary>100000</salary>
</staff>
<staff id="2001">
<firstname>low</firstname>
<lastname>yin fong</lastname>
<nickname>fong fong</nickname>
<salary>200000</salary>
</staff>
</root>