© 2009 David Gustafsson

Discovering the Strengths of XML

This week has been great. The courses have started for real which means a lot of work. Today is Sofia’s birthday that we are celebrating tonight. She has a lot of work to do and is at school doing group work at the moment. I am studying at home. Finally I have decided to take the International Project Management course. We had a class today with the teacher that will be having us for the semester and he was much better! The topic is also not so focused on cultures and psychology as the first teacher described last time. It will be a great course!

The toughest courses so far is Applied marketing research and Web applications engineering. They are also the most interesting courses, which is probably the reason for them to be tough (I make them tough). The past week we have gone through XML. Of course I have come across with XML before in my life but I got an “aha”-experience this time when really using it in an application. The strengths with XML are that it is very flexible for storing data in the structure that is best at the moment. This is opposite of a relational traditional database, that is fixed once you have set it up.

If I for example have a document describing courses at UNSW:

<c:Courses xmlns:c=“http://www.example.org/CourseSchema”

xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”

xsi:schemaLocation=“http://www.example.org/CourseSchema CourseSchema.xsd “>

<c:School>UNSW</c:School>

<c:Course Number=“COMP9211″ Credits=“6″>

<c:Title>Web applications engineering</c:Title>

<c:Teacher>

<c:LastName>A name</c:LastName>

<c:FirstName>a first name</c:FirstName>

</c:Teacher>

</c:Course>

<c:Course Number=“MARK5811″ Credits=“6″>

<c:Title>Applied marketing research</c:Title>

<c:Teacher>

<c:LastName>A teacher last name</c:LastName>

<c:FirstName>A teacher name</c:FirstName>

</c:Teacher>

</c:Course>

</c:Courses>

I can open this document in a browser, with word, in PDF, ODF or you name it by formatting it to the format right format. Word, PDF and browsers all are built on formats similar to xml. You do this by using a XSLT stylesheet (view the source code).

Above or here is an example of an unformatted document in XML. Here is an example of how it looks formatted for the web. The schema behind the XML document can be found here. Change this and you can change the structure of the XML document. Write a Stylesheet according to the word format and open the document with word.

Tonight I will take Sofia to a restaurant and tell her I love her. Tomorrow we will go to a Australian Football game in Sydney watching “the Swans”. I look forward to that.