On 1 October 1998, Level 1 of the Document Object Model became a W3C Recommendation.
A basic HTML document has a static data format which the browser renders. If the user wants to vary the presentation by using, for example, scripts, there is a need to access the content and structure (information) that defines the document.
The DOM object model provides a common framework for how scripts reference the elements of a document; how styles are applied to elements; and how scripts can change styles.
Suppose we have this simple HTML page:
<HTML> <HEAD> <TITLE>My Document</TITLE> <STYLE type="text/css"> H1 {color: black} </STYLE> </HEAD> <BODY> <H1>The DOM</H1> <P ALIGN="Center">For <B>all</B> you need to know</P> <A HREF="dominfo.html"> <IMG SRC="dom.gif"> and more!</A> </BODY> </HTML>
This would probably have been transformed to an internal form resembling the structure below and appearing as shown in the next column.
For all you need to know
and more
What DOM is trying to achieve is to provide a standard Applications Programming Interface (API) for manipulating this internal form using a programming language such as ECMAScript. To do that you need to have a model of all the bits that make up the document. Even a simple document, as the one above, has quite a bit of detail and structure once you start examining it (as we can see from the diagram).
The emphasis in DOM Level 1 is on how you access things not how you represent them. It is envisaged that the internal structure may vary significantly depending on the type of product that is using the DOM. A browser and editor might have the document information stored quite differently for performance reasons.
If this had been an XML document, the structure and content would be quite similar except that the node labels would vary according to the defined markup. In consequence, DOM has been defined so it works equally well with both HTML and XML.
Using DOM Level 1, you can access and make changes to the document, the images associated with it, how it is styled etc. A script can refer to an element by giving an absolute reference or by giving its position relative to another entity. The script can add, shuffle and delete elements in the document.
Given an object, you can find out where in the document tree it is located. You can refer to the parent or the child of an object as well as its siblings. You can use these references to walk up or down the document tree.
DOM Level 1 is basically a framework. It defines what an element object and an attribute is and how you can access them. It does not have much navigational functionality to let you search though collections of entities.
The next stage, past Level 1, will be to define reactions that a document can make itself to events that apply to it. DOM will ensure that the functionality introduced by Netscape and Microsoft with their Dynamic HTML offerings can be implemented in a standard way. For example, it would allow the document to change the style of the H1 title, say, when the mouse passes over it. The Recommendation can be found at: http://www.w3.org/TR/REC-DOM-Level-1/.
Janne Saarela has produced a reference implementation of an RDF parser which does a compilation process from XML encoding syntax to the triples of the underlying data model. The work was done as part of the W3C Esprit Leveraging Action (W3C-LA). There is a command line interface and you can embed it within a Java program. There is an interactive compilation service with an additional Java applet that allows you to browse through RDF data model. It is available at: http://jigsaw.w3.org:8000/description.
HTML TIDY is a free utility from W3C for automatically fixing HTML mistakes and tidying up the layout of the HTML page. It corrects errors where it can (an H2 end tag on a H1 header will be changed to an H1 end tag) and ensures that all end tags appear. It puts quote marks around attribute values where necessary. It even spots missing > on tags. If you ask it to, it will even create a style sheet to replace embedded styling. It is written in C and is available for a variety of platforms. For details, see: http://www.w3.org/People/Raggett/tidy/.
XML processors tend to only accept files that precisely follow the standard. TIDY can help you avoid many of the errors that cause XML files to be rejected although it does not support all XML features yet.
Membership continues to rise and has now reached 283 with a regional break down of:
Full | Affiliate | |
---|---|---|
Americas | 42 | 125 |
Europe | 28 | 54 |
Asia-Oceania | 14 | 20 |
Recent new members are:
New Web Developments and Experience in European Industry is the title for the event at the Royal Society of the Arts in London on Tuesday, 8 December 1998. This will be an all-day event concentrating on the future developments in the areas of XML, RDF, CSS, XSL, vector graphics, multimedia etc. These talks will be complemented with another set from industry on how they are using the new web standards. The event will have a range of demonstrations related to the talks.
We are signing up a strong list of speakers. From W3C, Hakon Lie will be talking on CSS and XSL. Daniel Dardailler will discuss the way styling is being used to make the Web more accessible to people with disabilities. Janne Saarela will be talking on RDF. We will mail out the Full Programme and sign-up details before the end of October.