internet.com

Go to WebDeveloper Home


hm-v6-139x61.gif

Database Journal: The Knowledge Center for Database Professionals

find a web host with:
CGI Access
DB Support
NT Servers
UNIX Servers
Telnet Access

advanced search
jobs

Get FREE Development Info via your Email!

The Webdeveloper channel
FlashKit
GIF.com
HiermenusCentral
webdeveloper Jobs
Java Boutique
JavaScript.com
JavaScript Source
ScriptSearch
StreamingMedia World
WDJ
WDVL
WebDeveloper.com
WebReference.com
XMLFiles.com

internet.com
Internet News
Internet Investing
Internet Technology
Windows Internet Tech.
Linux/Open Source
Web Developer
ECommerce/Marketing
ISP Resources
ASP Resources
Wireless Internet
Downloads
Internet Resources
Internet Lists
International
EarthWeb
Career Resources

Search internet.com
Advertise
Corporate Info
Newsletters
E-mail Offers

internet.commerce
Be a Commerce Partner










 
THE XML FILES
A WebDeveloper.com Feature

What DOMinates XML?

by Nate Zelnick

Understanding the DOM

Last time I talked about the problems of a work in progress like XML. XML has a lot of potential and it will change the world eventually, but there are a few things that have to happen first.

In the last two weeks, the W3C has released its proposed recommendation for the Document Object Model (DOM) Level 1 specification and a draft for the eXtensible Style Language (XSL) as well as a new proposal for namespaces. Of all of these, the most immediately important is likely to be the DOM Core and Level One specification.

DOM Core Level 0 (which came out about a year ago) described what worked between Navigator and Internet Explorer in some very broad terms. Since XML has emerged as the underlying structure for HTML itself -- an issue that has some very disturbing ramifications I'll deal with in a later column -- DOM Core Level One is now the basis for describing structured documents.

The Core actually describes any structured document and has some special extensions for XML. DOM Level One HTML is specifically designed for the conveniense of browser makers to provide a common structure for how HTML documents are to be represented.

Confused yet? Wait, it gets better: A browser that has no intention of supporting XML need not support the parts of DOM Core that are designed for XML but must support all of DOM Level One HTML. But a browser maker that wants to say that it supports the DOM (even DOM Level One HTML) must support the base Core. What we want as developers is full DOM compliance, of course, including both Core (with XML) and Level One.

So What Is A DOM, Anyway?

A DOM is a way of representing the elements and attributes of document as a logical structure that can be worked with by some outside programmatic means. In that sense, it is the Application Programming Interface (API) for a document. A document is actually a term that we use to describe any XML or HTML structure, since a lot of the ways that XML will be used have nothing to do with data that will be displayed to a user.

It is critically important to note that the DOM does not specify a programming language. This is how Netscape's JavaScript-based object model in Navigator worked (and actually continues to work). The JavaScript DOM exposes a document's elements as a set of arrays of elements. The standard DOM exposes elements as an abstract set of container relationships, much more like traditional object-oriented programming models.

The easiest way to think about how the DOM views a document is to look at a diagram of how elements and objects are related to each other.

For instance, if you had a simple HTML document that looked like this:

<HTML>
 <HEAD>
  <TITLE>A Document</TITLE>
 </HEAD>
 <BODY>
  <H1>This is a document</h1>
  <P>The Body has text.</P>
 </BODY>
</HTML>

You would represent this structure as a tree of objects that looks like this:

simple dom

[ Click here to move to the next part of the article ]

Fast Jump to Anywhere on WebDeveloper.com®:



internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs


Contact the WebDeveloper.com® staff

Last modified: Friday, 22-Aug-2008 13:46:48 EDT

 

Refresh Daily
Join Editor-in-Chief David Fiedler The Editor With No Time and find truth, justice, and a clue or two.


Browse by Category
[ Site Map ]

ActiveX / VBscript
Animated GIF Archive
Browsers
CGI / Perl
Database Connectivity
E-Commerce
HTML-Advanced: DHTML, CSS
HTML / Site Authoring Tools
Intranet/Groupware
Java
JavaScript
Multimedia: Audio / Video / Streaming Technologies
Opinions
Refresh Daily: Editorial Column
Security
Servers & Server Tools
Site Design / Graphics
Site Management / Marketing / Log File Analysis
VRML / 3D
XML