In the same way that there is more than one paradigm in
programming, there is more than one way to look at XML.
As for the former, there is procedural, Object-Oriented
Programming (
OOP
)
and Aspect-Oriented Programming (
AOP
).
In the same manner, there are a number of ways to look at XML:
as simply a way to store and/or transmit data
XML can be viewed as yet another format for storing data items.
In some ways, this is equivalent to doing procedural
programming in an object-oriented programming language.
The advantage is that you can get the immediate job
done fairly well without having to shift your paradigm.
The disadvantage is that procedure code is typically not reusable.
So the next time a similar task needs to be accomplished, new
code must be developed. This is called
Reinventing The Wheel (RTW)
.
Likewise, simply looking at XML as a way to store and/or transmit
data can make it easier to implement a specific application.
An example of this is
RSS
0.9x / 2.0, which makes good use of XML as a way to transmit data items to accomplish the job of delivering syndicated web feeds.
The limitations of this might not be apparent until you start encountering
problems with the schema or, such as in the case of RSS, the lack of one.
Because of this, RSS feeds cannot be validated with standard XML validators;
it becomes necessary to "reinvent the wheel" with validation specific to the RSS format.
The lack of a determistic schema is one of the
limitations of RSS
and is not even resolved with the
Atom Syndication Format,
although Open Feed Format
does provide one and can be easily transformed into either RSS or Atom Syndication Formats.
as a way to store and/or aggregate content
It takes a serious paradigm shift to start looking at XML as a
way to store content, rather than just collections of data items.
This is equivalent to the shift in paradigms from looking at an
object-oriented programming language as a set of procedural
instructions to a way to manipulate more robust objects.
This is the biggest jump that is needed in making good use of XML,
just like understanding objects is the biggest jump in understanding OOP.
When you see code written in an OOP language that is consistently
passing a particular object as a parameter to almost every method,
you recognize that the author of that code has not yet made the leap.
Likewise, when you look at the design of the RSS feed format,
you can see that the author(s) had not yet made the leap to the next level,
(or possibly that they did not want to rely on users having made the leap).
This does not mean that you have to abandon
HTML
development.
On second thought, I take that back - actually, yes it does.
It means you have to abandon 1997
HTML
4.x development and
IE 4.x compatibility in favor of
XHTML
and more recent browsers.
XHTML
web pages are simply a particular type of XML documents.
Therefore, you should start to think of
XHTML
not just as a markup language
for creating web pages, but as a means for delivering content.
Once you've made this leap to the new paradigm, you can do things like:
separate the content of your web site from the presentation
make better use of content by tailoring the presentation
of the content for specific delivery channels; an example
would be for users of handheld devices such as cell phones and
PDAs
.
See Sample .mobi for a good example of this.
move common elements, those things that provide the
look and feel (LaF)
of a web site, into templates, which, because they can be cached by most
browsers, reduces bandwidth requirements and improves page load times
as a way to integrate content
Aspect-Oriented Programming takes
OOP
to the next level by looking at objects in multiple dimensions,
rather than just a single dimension.
The analogy with the three-dimensional space, of which we are
quite familiar, would be that OOP looks at objects in the vertical
(up/down, class/subclass) direction, and AOP adds the horizontal directions.
The view of objects in the horizontal directions are called cross-cutting concerns.
Likewise, if you've already made the leap to looking
at
XML
as a way to store and/or aggregate content,
it's relatively easy to take this to the next level and
consider XML as a means for integration of content.
Content and navigation do not need to be limited to simply
moving through web pages in sequence; it can simultaneously
be gathered from multiple directions and integrated.
This was the promise of the Semantic Web,
but has been painfully slow in becoming reality, presumably
because most content providers have not yet even made the
first leap in making good use of XML in their content.