XML: content bundled with presentation?

March 31, 2009


There is a growing interest in Domain Specific Languages (DSL), and feeling that this technology would eventually render XML obsolete. Consider the following example of “2+2=4” written in XML:

snap1

Aside from being insulting to reader’s intelligence, can you spot what is wrong with it? Where do these tree node annotations are coming from? Consider a grammar for expression parser:

constraint : expression ‘<‘ expression
| expression ‘=‘ expression

expression : expression ‘+’ expression
| number

In formal languages and parser theory world we have clear separation of the data (that is “2+2=4”), on one hand, and the schema describing the structure of the data (that is the expression grammar), on the other. In XML world the data and the schema are bundled together into some caricature of the parse tree. Yes, skipping parsing as the hard part of the job is somewhat handy, but what happened to the famous programming principle “Separate content from presentation”?

Advertisements

2 Responses to “XML: content bundled with presentation?”

  1. raghvendra saboo Says:

    use XSD or it’s older cousin DTD ?

  2. Simon Bertrang Says:

    Once again i’m happy to read an article that shows how pointless this whole hype is.
    As if there weren’t enough languages to choose from… just provide a few basic functions/classes/methods/whatever and document how to use them in the affected domain.

    Whatever, it’s waste of energy to comment on this nonsense… i just couldn’t resist to agree.
    Now back to actually interesting things… which is the reason i came to this fine blog 🙂


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: