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

SVG DOM Specifics

The SVG specification defines various characteristics of the SVG DOM and its elements that extend the DOM2 model. They add a great deal of functionality, but unfortunately much of this functionality has yet to find its way into the implementations. However, the power of DOM being what it is means that this isn't a problem in practice, and the application we are now going to look at barely uses the extensions at all.

Squirrel: A DOM-Based Server Application

We will now look at a practical server-side Java application that uses DOM to generate SVG. The application is essentially an XML tree browser, but rather than showing the usual tree-centric explorer type of view, it provides an element-centric view. Elements are displayed as labeled shapes onscreen using dynamically generated SVG. In each display, an element is considered the focus, and only the other elements that are directly linked to it are displayed, that is, its parent and immediate children. Clicking on one of the peripheral elements brings up another view, with the element clicked as the new focus. This could be likened to what a short-sighted squirrel sees as it clambers around a tree, hence, the name. The application shows DOM elements as shapes labeled with the element name and any text contained in the elements. The focus also has a listing of the corresponding element's attributes. This parent + focus + offshoots representation can be considered an abstract data structure, which we'll be referring to as a “sprig” (“twig” is already overloaded by XML-ers).


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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