Home > Articles

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

This chapter is from the book

Programming Exercises

These exercises assume that you have a file called aliens.xml with the following content:

<?xml version="1.0"?>
<aliens>
  <alien>
    <classification>GS3</classification>
    <species>Isaboreans</species>
    <planet>Isabore 3</planet>
    <range confirmed="yes">3000000</range>
  </alien>

  <alien>
    <classification>PPW</classification>
    <species>Rowaria</species>
    <planet>Roware 9</planet>
    <range confirmed="no">400000</range>
  </alien>

  <alien>
    <classification>IOPO</classification>
    <species>Discoria</species>
    <planet>Bearost 4</planet>
    <range confirmed="yes">9000</range>
  </alien>

</aliens>
  1. Using your chosen language, create a Document object.

  2. Alter your application to retrieve the root element and output its name.

  3. Display the species names.

  4. For each alien element, display the name and text of each element node.

  5. Make sure all confirmed attributes have a value of yes.

  • + Share This
  • 🔖 Save To Your Account