Semantics VS definition
Say the words "semi-structured data" and almost every technologist you talk to will think "XML" and not "RDF." Tell one about RDF vs. XML and he'll reply, "Why do I need something else? I already have XML for that!"
However, as a growing Semantic Web technology expert, you will patiently smirk and know that XML is simply not a substitute for RDF, and that it is very poorly suited for the distributed data linking that RDF is meant to do.
This lesson will compare and contrast XML and RDF and make recommendations on when to use one vs. the other.
RDF and XML both attempt to address the problem of enabling different programs and different computers to communicate effectively with each other. In its own way, each takes an important step towards a universal lingua franca for data.
This similar goal of creating a means for any system to communicate with any other is the basis for the confusion. However, there is more to it than that.
A Serialization Format vs. a Data Model
There are, broadly speaking, two problems when parsing a file or data sent over a network. The first is simply being able to read the data in—to translate the series of bytes on disc into logical data. The second is to do something intelligent with that data, such as display it in on the screen. XML solves the first of those problems, and RDF solves the second of them.
This brings us to the major foundational difference between XML and RDF. XML is primarily a serialization format (we'll define this in a little more detail in a minute), while RDF is primarily a data model. From the beginning they are meant to serve two distinct purposes.
RDF vs. XML: An Analogy
Consider the book A Christmas Carol (which, by the way, really is excellent and absolutely deserves to have 100 different film adaptations).
Yet every one of those formats is still somehow the same book. The fact that it can be paper or electricity doesn't fundamentally change the book itself.
For example, let's say that I have two copies of A Christmas Carol: one in braille and one in regular print. Are they the same book?
From the point of view of RDF they absolutely are the same book. The book's meaning is what matters in RDF. The information represented by RDF retains its self-same meaning regardless of its underlying format. If you save RDF file in Turtle or RDF/XML it's still the same information. Braille or print: it's the same book.