This work is licensed under a CC |
XML in used in a wide variety of application scenarios, resulting in a wide variety of requirements. This lecture introduces the application example used in this course, which is the representation of blog data in XML. Blogs are a good example for XML, because of their mix of structured data (blog post metadata) and textual data (the actual blog post), the requirement to derive different views (such as weekly and monthly summaries) from the same set of data, and the requirement to make the data available in various output formats (such as HTML and RSS).
count(//post)
//post[2]/title
for $i in //post return days-from-duration(xs:date($i/@date) - xs:date($i/preceding-sibling::post[1]/@date))
for $i in //post return days-from-duration(xs:date(//post[last()]/@date) - xs:date($i/@date))
<html> <body> <p><a href="2007-05-15">Tuesday May 15, 2007: Half Dome</a></p> <p><a href="2007-05-20">Sunday May 20, 2007: Fifth Lake</a></p> <p><a href="2007-05-22">Tuesday May 22, 2007: Golden Canyon</a></p> </body> </html>
<html> <body> <h1>Half Dome</h1> <h2>Tuesday May 15, 2007</h2> <a href="../img/half-dome.jpg" title="Me on top of half dome."><img src="../img/half-dome-small.jpg"></a> <p>The trip to half dome is a long one, but very beautiful and with a spectacular final climb.</p> <p><a href="dretblog2">Home</a><a href="2007-05-20"> →</a></p> </body> </html>