Home > Articles > Web Services > XML

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Exercise

  1. Create a program using XML::Simple that will parse the following XML document shown below and convert it to a CSV formatted file. Using the same structure, change all first names to reflect only a first capitalized initial (for example, Ilya to I), then output this file to a new XML document.

    <?xml version="1.0" ?> 
    - <users>
    -  <user>
       <first_name>Ilya</first_name> 
       <last_name>Sterin</last_name> 
       <email_address>isterin@cpan.org</email_address> 
      </user>
    -  <user>
       <first_name>Mark</first_name> 
       <last_name>Riehl</last_name> 
       <email_address>mark_riehl@hotmail.com</email_address> 
      </user>
    -  <user>
       <first_name>John</first_name> 
       <last_name>Smith</last_name> 
       <email_address>j.smith@xmlproj.com</email_address> 
      </user>
     </users>

For suggested solutions to this exercise, be sure to check out the web site: http://www.xmlproj.com/book/chapter02.

  • + Share This
  • 🔖 Save To Your Account