XML vs. Relational databases? I feel like this isn't the best question to ask on a programming site like this, but I haven't really found a satisfying answer online and I would really like to get a different perspective on this. 

Currently, we're working on a project at school, but instead of relational databases, we are instructed to use XML databases and related technology (XQuery, XPath and the like). I find that writing the code and infrastructure is quite straightforward, but even after working with it for a while, I can't seem to wrap my head around the advantages of choosing XML databases over a relational model. 

My questions, then, are:


Could you describe some advantages that XML databases have over relational?
Could you provide an example where it might be better to use an XML database over a relational one?
I use XML when I need more flexible structure than a database table can offer.

When you have data that you do not know exactly the structure beforehand, it could be profitable to store it as XML. You can store such XML in a relational database field, as many e-learning systems do.

In fact e-learning course structure is a good example because individual courses could be quite different from each other. 

So XML is somewhere between a document and a relational-table. Imagine a database table where each record would have a very different structure, that would be good use for XML. 

Also XML is very good for data interchange, meanwhile files like .DBF, .XLS etc. are not so good.