XML technologies / SVG / Interactive graphics / Scripting basics / What is the DOM?

(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)

DOM stands for Document Object Model and denotes a hierarchy of objects and methods. XML documents such as SVG graphics provide a special XML DOM, here called the SVG DOM, similar to the W3C DOM supported by Netscape 6.0. Objects provide access to individual elements of the SVG graphic. Methods insert or remove elements and change properties, such as fill color or filter effects. DOM use is explained later.

Besides the DOM, you also need event notifications, or events. These define situations in which functions or script instructions, called event handlers, can run. Clicking an element, for example, triggers the event onclick, to which you assign a function to execute. This chapter’s first example shows the events onmouseover and onmouseout, corresponding to their HTML namesakes. onmouseover occurs when the pointer enters the element; onmouseout when it leaves.

Note:
SVG scripting works like web page scripting, except browsers behave very similarly with these scripts. Minor differences exist, but almost every script works immediately across browsers. Netscape Navigator can, however, fail to reflect edited scripts after a reload: source view shows new code while the graphic still uses the old code. This may wrongly suggest the code is broken. Usually, close all Netscape windows, restart it and reload the file.

   

 

 

 

back to top