Building an XML Application

Database Example

Now we can make calls to the database to see who Yoko Brown's children are:

"SELECT * FROM Mother, Child WHERE MID=23401 and MID=mother";

 

XML vs Database
Comparison XML Database
Raw Data Elements and Attributes Rows and Columns
Searching XSLT, XPath, and eventually XQuery SQL-variant
Data Less structured, more hiearchical Highly structured and volatile
Performance Low due to nature of text files Highly efficient
Portability Great - ascii text is extremely portable Low

 

Option 1
<laslave>
 <slave gender="male">
  <firstName></firstName>
  <birth>
   <location></location>
   <date>
    <month></month>
    <day></day>
    <year></year>

   </date>
  </birth>
  <race></race>
  <owner>
   <firstname></firstname>
   <surname></surname>
   <location></location>

   <purchase>
    <date>
     <month></month>
     <day></day>
     <year></year>

    </date>
    <seller>
     <firstname></firstname>
     <surname></surname>
    </seller>
    <exchange grouping="yes">
     <currency>Piastre</currency>
     <cost>1100</cost>

    </exchange>
   </purchase>
   <sale>
    <buyer></buyer>
   </sale>
  </owner>
  <document id="">
   <location></location>
   <date>
    <month></month>
    <day></day>
    <year></year>
   </date>
   <language name="" code="" />
  </document>
  <skill></skill>
  <skill></skill>
  <comment><comment>
 </slave>
 <slave>
 </slave>
</laslave>
 

 

Option 2
<laslave>

 <slave id="" sex="">
  <source id="">
   <firstname></firstname>
   <birth>
    <location></location>
    <date>
     <month></month>
     <day></day>
     <year></year>
    </date>
   </birth>
   <skillset>
    <skill></skill>
    <skill></skill>
   </skillset>
   <health>
    <illness></illness>
   </health>
   <miscellaneous>
   </miscellaneous>
  </source>
 </slave>

 <master id="" gender="">
  <source id="">
   <firstname></firstname>
   <middlename></middlename>
   <surname></surname>
   <estate>
    <city></city>
    <state></state>
    <worth></worth>
    <inventory>
     <slave id="">
      <purchase group="yes">
       <seller>
        <firstname></firstname>
        <surname></surname>
       </seller>
       <currency>Piastre</currency>
       <cost>1100</cost>
      </purchase>
      <sale group="no">
       <buyer>
        <firstname></firstname>
        <surname></surname>
       </buyer>
       <currency>Dollar</currency>
       <cost>10</cost>
      </sale>
     </slave>
     <slave id="" />
    </inventory>
   </estate>
  </source>
 </master>

 <family id="">
  <father master="" />
  <mother slave="" />
  <child slave="" />
  <child slave="" />
 </family>

 <document id="">
  <notary></notary>
  <parish></parish>
  <date>
   <month></month>
   <day></day>
   <year></year>
  </date>
  <language name="" code="" />
 </document>

</laslave>