Posts

Showing posts from February, 2012

Parsing XML using Java

The idea here is to parse the employees.xml file with content as below <?xml version="1.0" encoding="UTF-8"?> <Personnel>   <Employee type="permanent">         <Name>Seagull</Name>         <Id>3674</Id>         <Age>34</Age>    </Employee>   <Employee type="contract">         <Name>Robin</Name>         <Id>3675</Id>         <Age>25</Age>     </Employee>   <Employee type="permanent">         <Name>Crow</Name>         <Id>3676</Id>         <Age>28</Age>     </Employee> </Personnel> From the parsed content create a list of Employee objects and print it to the console. The output would be something like Employee Details - Name:Seagull, Type:permanent, Id:3674, Age:34. Employee Details - Name:Robin, Type:contract, Id:3675, Age:25. Employee Details - Name:Crow,