• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

XML and HTML Compared

Although it's based on the same parent technology that gave rise to good old HTML (and just like HTML, it uses tags, attributes, and values to format structured documents), XML is quite different from the venerable markup language it's intended to replace.

HTML is a basic language for marking up web pages. It has a fixed number of tags and a small set of somewhat inconsistent rules. In HTML, you must close some tags, mustn't close others, and might or might not want to close still others, depending on your mood. This looseness makes it easy for anyone to create a web page, even if they don't quite know what they're doing—and that, of course, was the idea.

It was a fine idea in the early days, when the web needed basic content and not much else. But in today's more sophisticated web, where pages are frequently assembled by publishing tools and content must flow back and forth from database to web page to wireless device to print, the lack of uniform rules in HTML impedes data repurposing. It's easy to convert text to HTML, but it's difficult to convert data marked up in HTML to any other needed format.

Likewise, HTML is merely a formatting language, and not a particularly self-aware one. It contains no information about the content it formats, again limiting your ability to reuse that content in other settings. And, of course, HTML is strictly for the web.

XML-based markup, by contrast, is bound by consistent rules and is capable of traveling far beyond the web. When you mark up a document in XML, you're not merely preparing it to show up on a web page. You're encoding it in tags that can be understood in any XML-aware environment.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint