Web Site

Internet-description.com



» Internet » Web development » Topics begins with D » Document Object Model


Page modified: Saturday, June 24, 2006 10:37:39

The document Object Model (CATHEDRAL) is a programming interface (API) for the access to HTML or XML documents. It is defined by the World Wide Web Consortium.

In the sense of object-oriented programming that consists CATHEDRAL of a sentence of classes as well as their methods and attributes. It permits contents dynamically to computer programs to change the structure and the layout of a document.

History

CATHEDRAL originally developed under the impression of at least two developments, which coined/shaped the computer world in the recent past considerably. Both is the basis the necessity to be able to access the structured data in HTML and XML documents simply and uniformly.

Center of the 1990er-Jahre, when the World Wide Web became ever more popular, was invented the programming language Javascript and usual Webbrowser contained since then interpreters, that implement such Scripte. Javascript defined rudimentary possibilities for the access to the HTML document and the event treatment. Later different Browserhersteller invented different models for dynamic HTML (DHTML), which made possible a more comprehensive change the structure and the appearance of the document, while the document in the Browser is indicated. The first cathedral standards of the W3C represent the attempt to unite the different prop. guessing eras Javascript and DHTML techniques, which developed during the time of the Browserkriege, to standardize and in the long run replace. This succeeded, so that CATHEDRAL takes nowadays a central meaning during Javascript programming.

At the same time XML developed as general exchange format for the human being-readable representation of structured data, which tied to the success of HTML. For the processing of XML documents an understandable, efficient and programming language-spreading interface was necessary. CATHEDRAL represents such and defines beyond that additional interfaces for comfortable handling XML documents.

Bases CATHEDRAL on the basis an example

The following HTML code defines a table with the element table and different Unterelementen:

<table> <thead> <tr> <th>Vorname</th> <th>Name</th> </tr> </thead> <tbody> <tr> <td>Donald</td> <td>Duck</td> </tr> </tbody> </table> 

CATHEDRAL represents the table element and its Unterelemente in the following tree structure:

By this example the structure in principle of the object model can be discussed: Documents are represented logically like a family tree. Knots (nodes) stand over "“family relations"” to each other in connection.

Kinds of relations

The available structure is characterized in the object model by the following relations:

  • The root knot table has the element knots as children (children) thead and tbody.
  • The table Elementknoten turned around parents (parent) of thead and tbody.
  • Knots with common parents (e.g. the two th-Elementknoten) are called brothers and sisters (siblings).

On the basis of the root knot every other knot is attainable over these family relations.

Kinds of knots

The most important knot types in the CATHEDRAL are:

  • A document knot represents the entire tree structure.
  • A document fragment knot represents a part of the tree structure.
  • An element knot corresponds accurately to an element in HTML or XML.
  • An attribute knot corresponds accurately to an attribute in HTML or XML.
  • A text knot represents textuellen contents of an element or an attribute.

Attribute knots represent a special kind of knot, because they do not occur as knots in the tree structure, which is formed particularly by element knots. Attribute knots are therefore none "„children "“from element knots, but characteristics of them.

Processing of a document

In the first step an existing document is read in by the program and a document object is produced. On the basis this object can be accessed by means of the methods of the API contents, structure and representation.

In particular CATHEDRAL permits

  • navigation between the individual knots of a document,
  • producing, shifting and deletion of knots as well as
  • the selection, changing and deletion of text contents.

At the end of the processing through serialization so mentioned a new XML or HTML document can be generated from the document object.

Standardisation CATHEDRAL

CATHEDRAL is since 1998 a standard of the W3C and was since then updated several times and extended. In each case several versions (levels) exist with different modules:

"„CATHEDRAL level 0 "“

This level was never formally specified. Level 0 designates the techniques usable by means of Javascript to the access to HTML documents. These were introduced by Webbrowsern such as Internet Explorer and Netscape navigator before the standardisation of the cathedral.

CATHEDRAL level 1

  • CATHEDRAL core (cathedral core) defines a moving in the cathedral tree, the manipulation of the knots, including inserting new elements and setting attributes.
  • CATHEDRAL HTML represents an extension to the access to HTML documents. It standardizes and completes the practice already spread, which on the Javascript specifications of Netscape and/or Microsoft JScript is based.

CATHEDRAL level 2

  • CATHEDRAL core: among other things extension by XML Namensraum support
  • CATHEDRAL HTML: among other things expansion on XHTML documents, adjustment at CATHEDRAL 2 core
  • CATHEDRAL Style and CATHEDRAL CSS make the dynamic selection, adding and a changing of formatting and/or the layout of the document over Stylesheets, in particular for Cascading possible Style Sheets (CSS).
  • CATHEDRAL Views permits the access to information of concrete kinds of rendition of the document (e.g. the diagram in the Webbrowser). This is used particularly together with CATHEDRAL CSS, in order to bring the actual CSS Eigenschaftswerte of certain elements in experience (e.g. "‚which background colour has this `).
  • CATHEDRAL Events standardizes the processing of events in the document, e.g. user actions. Particularly in connection with Javascript during the representation by HTML documents in Webbrowsern one uses. Leaned against the models of the event treatment of the Netscape of navigator and the Internet Explorers for HTML documents.
  • CATHEDRAL Traversal and rank: Goes through the knot tree on the basis certain criteria for choice, work with ranges in the document, which cover certain elements and text knots

CATHEDRAL level 3

  • CATHEDRAL 3 core: comprehensive extension, among other things improved exception treatment and handling indication coding
  • CATHEDRAL 3 load & save makes the serialization of documents or document parts as well as the Parsen possible of XML documents in character strings into document objects. Besides XML documents over HTTP can be dispatched and called up, as it is possible with the more well-known XMLHttpRequest technology.
  • CATHEDRAL 3 XPath permits a selecting of knots on the basis XPath
  • CATHEDRAL 3 Events extends CATHEDRAL 2 Events among other things by keyboard events.
  • CATHEDRAL 3 Validation
  • CATHEDRAL 3 Views and Formatting
  • CATHEDRAL 3 Abstract pattern

See also: Simple API for XML (SAX), JDOM

Related links


Articles in category "Document Object Model"

We found here 2 articles.

D

» Divitis
» Document Object Model

Related Websites

We found here 5 related websites.

Page cached: Wednesday, July 5, 2006 23:57:17
Valid XHTML 1.0!  Valid CSS!

Page copy protected against web site content infringement by Copyscape