|
Table of contents | Author | City | Company | Country | State/Province | Term | Interchange | ![]() |
Le Hégaret, Philippe
, W3C DOM Activity Lead , World Wide Web Consortium (W3C), Architecture Domain,
Cambridge
Massachusetts
U.S.A.
Email: plh@w3.org
Web site:http://www.w3.org/People/LeHegaret
Philippe Le Hégaret joined the World Wide Web Consortium (W3C) in January 1999 and is currently responsible of the Document Object Model (DOM) Activity. Philippe has been involved in XML since 1998 and developed the first version of the CSS Validator in 1997. He is the chair of the W3C DOM Working Group since November 2000, a member of the HyperText Coordination Group, and an invited member of the XML Coordination Group.
Started in the Summer 2000, the DOM Level 3 specifications will extend the functionalities in the W3C DOM platform. This document contains the background information on the W3C DOM API and a presentation of its architecture. The talk will cover the progress in all the new DOM modules: Core, Events, Abstract Schemas and Load and Save, and XPath.
W3C
's
DOM
is a standard
API
to the document structure and aims to make it easy for programmers to access components and delete, add or edit their content, attributes and style. In essence, the DOM makes it possible for programmers to write applications which work properly on all browsers and servers, and on all platforms. While programmers may need to use different programming languages, they do not need to change their programming model.
The purpose of this presentation is to report on the current situation in the W3C DOM Activity, in particular on the work being done by the W3C DOM Working Group.
Markup languages such as HTML or SVG provide different ways to include or link programming scriptings to the document. In order to use scripting capabilities on the Web, it is recommend to read the Web Content Accessibility Guidelines
before using scripts in your documents, in particular the guideline 6.
Specifications of existing scripting languages such as ECMAScript
(an industry-standard scripting language based on JavaScript and JScript) only give the syntax, the grammar and the basic types' functionalities (String, Object, Number, ...). These specifications don't give the user access to the user agent functionalities (menus, scrollbars, user events, ...) or to the document (text contents, markup structure, style sheets, ...). This is where the Document Object Model stands in the context of scripting.
In November 1996, the
W3C
released the first Working Draft of the
XML
specification
. Many applications of XML were done since then: editors, repositories, databases, B2B systems, Web content, network protocols, etc.
The XML specification only provides the syntax and the grammar for XML. Being able to access the XML content in an application requires more than that: it requires an Application Programming Interface (API).
Generic APIs for XML can be mostly classified in two categories: event-based or tree-based. The DOM is a generic tree-based API for XML. For more information about event-based APIs and a comparison with tree-based APIs, read the
documentation "
" or the DOM Frequently asked question (FAQ) "
".
// get the HTML body element from the document
var childs = doc.getElementsByTagName("body");
// there is one HTML body element for each HTML 4.0 document
var body = childs.item(0);
// change the value of the CSS2 color property
body.style.color = "black"; For a more advanced example, check the DOM Level 2 demo used in the main DOM page
.
The DOM Architecture is divided in various modules. Each module addresses or specializes an existing module for a particular domain. Domains covered by the current DOM API are XML, HTML, CSS, Events, Schemas, and XPath. Future domains can be the rendered content (such as the content displayed on the screen which might differ from your document), user agent interface (menus, ...), etc.
Definition:
The Core platform relies on an internal tree-like representation of the document, and enables you to traverse the hierarchy accordingly. The standard model of viewing a document is as a hierarchy of elements, with the computer building up an internal model of the document based on a kind of tree structure.
The DOM Range and Traversal modules can be used on the Core platform for tree manipulations.
Definition:
The DOM XML extends the Core platform for specific XML 1.0 needs such as processing instructions, CDATA, and entities.
Definition:
The HTML DOM provides a set of convenient easy-to-use ways to manipulate HTML documents. The initial HTML DOM merely describes methods, for example, for accessing an identifier by name, or a particular link. The HTML DOM is sometimes referred to as DOM Level 0 but has been imported into DOM Level 1.
Definition:
This part includes XML-tree manipulation oriented events with tree mutation or user-oriented (such as mouse, keyboard, or HTML-specific) events.
Definition:
The DOM CSS provides a set of convenient easy-to-use ways to manipulate CSS style sheets or styled documents.
Definition:
Loading an XML document into a DOM tree or saving a DOM tree into an XML document is a fundamental need for the DOM user. This module includes lots of options to control the load/save operations.
Definition:
Ever try to access the Document Type Information (DTD) from your DOM application? What is the datatype of an attribute or an element? This module lets the user access an abstract representation of the schema. The schema could be a DTD, an XML Schema, or whatever your DOM implementation support.
Definition:
The DOM XPath provides a set of convenient easy-to-use functions to query a DOM tree using an XPath 1.0 expression.
The DOM Activity, started in August 1997 in the User Interface Domain, contains only one Working Group: the DOM Working Group. The Activity was moved to the Architecture Domain in November 2000.
The DOM Working Group is a member of the HyperText Coordination Group and has a liaison with the XML Coordination Group.
LevelsThe DOM Working Group is working with phases or Levels. Two Levels (1 and 2) are already Recommendations. The Working Group is now working on Level 3.
The DOM requirements contains all requirements for the Levels of DOM. It is regularly updated to reflect the requirements of the latest Level.
Functionality equivalent to that exposed in Netscape Navigator 3.0 and Microsoft Internet Explorer 3.0 is referred to as "Level 0". There is no W3C specification for this Level.
The first Level of the DOM specifications, DOM Level 1, was completed in October 1998. Level 1 provides support for XML 1.0 and HTML.
The second Level of the DOM specifications, DOM Level 2, was completed in November 2000. Level 2 extends Level 1 with support for XML 1.0 with namespaces and adds supports for Cascading Style Sheets (CSS), events (user interface events and tree manipulation events), and enhances tree manipulations (tree ranges and traversal mechanisms).
The presentation will provide the current status of the DOM Level 3 since it is the one currently under development in the W3C.
The third Level of the DOM specifications, DOM Level 3, is under development. Level 3 will extend Level 2 by finishing support for XML 1.0 with namespaces (alignment with the XML Infoset and support for XML Base) and will extend the user interface events (keyboard). It will also add abstract schemas support (for DTDs, XML Schema, ...), the ability to load and save a document or an abstract schema, explore further mixed markup vocabularies and the implications on the DOM API ("Embedded DOM"), and will support XPath.
The XML Information Set (Infoset) specification
provides a set of definitions for use in other specifications that need to refer to the information in an XML document. Since the DOM API started in 1997, it now needs to be aligned with the Infoset, i.e. provides the mapping from the DOM API to the Infoset definitions.
The Infoset is based on XML 1.0
, XML Namespaces
and XML Base
. Therefore, DOM Level 3 Core will support these specifications.
The DOM Test Suites are currently under development in the DOMTS public forum
. This works is being done by the
NIST
, the
W3C
, and the public. The tests are described in XML, using the XML sources of the DOM specifications. The purpose is to provide conformance test suites for Java and ECMAScript but it is certainly not restricted to these two languages. A report on the current situation of this work will be presented during the talk.
[WCAG] Web Content Accessibility Guidelines 1.0 , Wendy Chisholm, Greeg Vanderheiden, Ian Jacobs, 5 May 1999. Available at http://www.w3.org/TR/WAI-WEBCONTENT
[ECMAScript] ISO (International Organization for Standardization). ISO/IEC 16262:1998. ECMAScript Language Specification . Available from ECMA (European Computer Manufacturers Association) at http://www.ecma.ch/ecma1/STAND/ECMA-262.HTM
[SAX] Simple API for XML , David Megginson. Available at http://www.megginson.com/SAX
[What is an Event-Based Interface?] What is an Event-Based Interface? , David Megginson. Available at http://www.megginson.com/SAX/events.html
[Document Object Model] W3C Document Object Model , maintained by the W3C DOM Working Group. Available at http://www.w3.org/DOM
[What is the relationship between the DOM and SAX?] What is the relationship between the DOM and SAX? , David Megginson. Available at http://www.w3.org/DOM/faq#SAXandDOM
[DOM Test Suites] DOM Conformance Test Suites . Available at http://www.w3.org/DOM/Test
[XML Information Set] XML Information Set , John Cowan, Richard Tobin, August 2001. Available at http://www.w3.org/TR/xml-infoset
[XML 1.0] W3C (World Wide Web Consortium) Extensible Markup Language (XML) 1.0 , Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, October 2000. Available at http://www.w3.org/TR/2000/REC-xml-20001006
[XML Base] W3C (World Wide Web Consortium) XML Base , Jonathan Marsh, June 2001. Available at http://www.w3.org/TR/xmlbase
[XML Namespaces] W3C (World Wide Web Consortium) Namespaces in XML , Tim Bray, Dave Hollander, Andrew Layman, January 1999. Available at http://www.w3.org/TR/1999/REC-xml-names-19990114
|
Table of contents | Author | City | Company | Country | State/Province | Term | Interchange | ![]() |