XML Examples II

Take note of the date attribute
<list>
<item>
<title date="10/02/2001">Waking Up with the Red-Eyed Monster</title>
<author>J.I.M. Somniac</author>
<blurb>The blood-chillingly true story of one man's fight against the monsters under his bed. </blurb>
</item>
<item>
<title date="11/12/1999">The Case of the Hungry Hippopotamus</title>
<author>P.I. Hardhat</author>
<blurb>A tough private eye is hired to solve the most challenging case of his career. </blurb>
</item>
<item>
<title date="12/25/1989">The Idiot's Guide to Sandwiches</title>
<author>B.L. Tuhmatto</author>
<blurb>Making tasty sandwiches has never been so easy!</blurb>
</item>
</list>

 

PHP Date Parsing
<html>
 <head>
  <title>Date Split Example</title>
 </head>
 <body>
<?
  $str = "10/02/2002";
  $dates = split('/', $str, 3);
  print("Month: $dates[0]<BR>\n");
  print("Day: $dates[1]<BR>\n");
  print("Year: $dates[2]<BR>\n");
?>
</body>
</html>
 

 

Date should look something like
<?xml version="1.0" standalone="yes"?>
<date>
 <month>11</month>
 <day>12</day>
 <year>1999</year>
</date> 

 

Take note of the date elements...we can associate more than one per parent now
<list>
<item>
<title>Waking Up with the Red-Eyed Monster</title>
<author>J.I.M. Somniac</author>
<blurb>The blood-chillingly true story of one man's fight against the monsters under his bed. </blurb> <date> <month>12</month> <day>02</day> <year>2001</year> </date> <date> <month>02</month> <day>30</day> <year>2001</year> </date>
</item>
<item>
<title>The Case of the Hungry Hippopotamus</title>
<author>P.I. Hardhat</author>
<blurb>A tough private eye is hired to solve the most challenging case of his career. </blurb> <date> <month>11</month> <day>12</day> <year>1999</year> </date>
</item>
<item>
<title>The Idiot's Guide to Sandwiches</title>
<author>B.L. Tuhmatto</author>
<blurb>Making tasty sandwiches has never been so easy!</blurb> <date> <month>12</month> <day>25</day> <year>1989</year> </date>
</item>
</list>