Thursday, February 24, 2011

XML and W3School

Hello fine folks!
I have been working on a XML project this morning.
So if you were ever wondering what hard spent educational money buys,
here is an excercise:

***also, I have updated this 3 times since 1st post since I have discoved incorrect syntax***
always keep checking!!!!

Teacher: "Go to http://www.w3schools.com/ and read the tutorial on XML. 
Then write (2) examples"
That's it!


I do have to say that the w3schools has helped me tremendously in the past with HTML and CSS,
so use it and embrace its resource.

Also, a good rule I have to pass along as well from another teacher referring to open/close tags:
"Tags are like butt cheeks. You need two of them or things get messy!"

Remember XML doesn't do anything, its just a way of describing your code
In XML pay close attention to elements and tag order,
you need to set up a sort of hierarchy.

Here is what I came up with,
this goes along with a custom database I am creating:

<?xml version="1.0" encoding="ISO-8859-1"?>
<pet_database>
<pets>
  <pet_id1000>
    <name>patches</name>
     <type>dog</type>
        <breed>german_shepherd</breed>
        <dob>2010-02-28</dob>
       <owner_id>15236</owner_id>
  </pet_id1000>
  <pet_id1001>
    <name>killer</name>
     <type>dog</type>
        <breed>rottweiler</breed>
        <dob>2010-01-15</dob>
       <owner_id>20012</owner_id>
  </pet_id1001>
  <pet_id1002>
    <name>fluffy</name>
     <type>dog</type>
        <breed>cocker_spaniel</breed>
        <dob>2008-06-17</dob>
       <owner_id>45637</owner_id>
  </pet_id1002>
  <pet_id1003>
    <name>Walter</name>
     <type>dog</type>
        <breed>husky</breed>
        <dob>2009-03-14</dob>
       <owner_id>23456</owner_id>
  </pet_id1003>
  <pet_id1004>
    <name>missy</name>
     <type>dog</type>
        <breed>st_bernard</breed>
        <dob>2010-11-11</dob>
       <owner_id>00045</owner_id>
  </pet_id1004>
  <pet_id1005>
    <name>cujo</name>
     <type>dog</type>
        <breed>chihuahua</breed>
        <dob>2007-01-31</dob>
       <owner_id>02025</owner_id>
  </pet_id1005>
</pets>
</pet_database>
Good times!
-A

1 comment: