eWebProgrammer eweb  





XML Programming  «Prev 

Creating a well-formed XML Document

  1. Type the xml declaration line <?xml version="1.0" ?> and press Return. Note that there is no white space between the < and ? in the start element.
    A blank XML file
    A blank XML file
  2. Every XML document must have one and only one root element. The root element contains all other elements. Type the root element name of this XML document <inventory-items> and press Return.
    Specify the XML version
    Specify the XML version.
  3. This XML document describes inventory items. To begin the description of one such item, type <item> and press Return .
    Item Name and Serial Number
    Item Name and Serial Number
  4. We will use <item-name>, <item-serial-number>, and <units-on-hand> elements to describe one inventory item. Type <item-name>Computer Monitor</item-name> and press Return.
    Computer Number
    Computer Number

  5. Type <item-serial-number>9812097</item-serial-number> and press Return.
    Computer Monitor
    Computer Monitor
  6. Type <units-on-hand>50</units-on-hand> and press Return.
    Computer Monitor Serial Number
    Computer Monitor Serial Number
  7. We are now done with the description of this inventory item. Type </item> and press Return.
    Computer Monitor, Serial Number, units on hand
    Computer Monitor, Serial Number, units on hand
  8. Type the end element for the document root element </inventory-items> and press Return.
    Close the XML item
    Close the XML item.
  9. You now have a well-formed XML document. Click Next to see what the document looks like when rendered in IE.
    Close the inventory items element in XML
    Close the inventory items element in XML

  10. This is what the XML document looks like when rendered in IE . This completes the Simulation. Click the Exit button.
    This is how the XML file looks when it is displayed in IE
    This is how the XML file looks when it is displayed in IE.