TOC PREV NEXT INDEX




HTML Rendering Engine


The HTML rendering engine, or the HTML 4 pilot, is a module with several internal components.

DOM

The core of the HTML rendering engine is the Document Object Model (DOM). This maintains an internal document representation and implements the DOM API provided by W3C. Java applications, and JavaScript embedded in an HTML document, can directly access the current document through the DOM API, and make changes or read the content. For more information on the W3C DOM, see http://www.w3.org/.

DOM is a decoupled representation of the document. HTML or XML representing the document is split into tokens and placed in the DOM tree. Other applications and modules can later traverse this tree to determine characteristics of the document.

Access is provided to the DOM through the W3C standard DOM Level 2 Core API. The DOM representation is pure because it can only represent a valid document. Validation is done on all HTML documents using the DOM builder.

DOM Builder

The DOM builder is the module that builds the DOM representation. The DOM builder is fed by the HTML/XML parser. It also calls validator modules to construct a valid DOM. This module supports XML namespaces (XMLNS).

DTD Validator and HTML DOM Fixer

Most HTML on the Web follows the HTML standard only loosely, and traditional desktop browsers do not implement the HTML 4 Document Type Definition (DTD) correctly. These desktop browsers can display invalid HTML and most Web page developers test their code by determining whether these browsers can display the page as they anticipated. This leads to more and more invalid HTML in Web documents.

The HTML DOM fixer is used to compensate for invalid HTML. This permits the ICEreader architecture to follow the standard strictly. The HTML DOM fixer contains a DTD for HTML 4.01. In addition to performing DTD validation, the fixer applies fuzzy logic to make incoming HTML conform with the DTD. A DTD-compliant document generates a valid DOM. A non-compliant document invokes the DOM fixer.

The DOM fixer is invoked when the DOM builder tries to insert an incorrect node into the DOM tree. The DOM fixer traverses the tree to find a location where that node can be placed according to the DTD. If a correct placement cannot be found, the DOM fixer applies a series of rules to insert additional elements into the tree until the new node can be correctly inserted. The result is always a valid DOM, regardless of the quality of the original HTML.

Parser

The parser takes the HTML and XML input and creates a data tree of all the tags in the document and their containment hierarchy. The parser is a logical module that interfaces with the DOM builder using its API.

Layout Engine

The layout engine renders elements from the DOM on the screen according to non-fixed rules, as the DOM can contain any kind of element, including the familiar HTML elements. The layout rules for any given document are specified in a style sheet. A style sheet interpreter is required to drive the layout engine.

All aspects of reflow, line, word, and character representation are optimized using proprietary technology. The layout engine uses a built-in HTML stylesheet to define the default layout rules. The default stylesheet can be modified to alter the rendering style of the HTML.

CSS Parser

A Cascading Style Sheet (CSS) is a mechanism for adding style such as fonts, colors, and spacing to Web documents. For more information on style sheets, see http://www.w3.org/style/CSS/. The style sheets live alongside the DOM and provide style information when the document is rendered. For example, you may want to render a document differently on paper or paged media than on a computer screen. The CSS represents these different styles.

The CSS parser is invoked when a document has an associated style sheet to parse the style parameters and create the CSS representation.

Screen Renderer

The screen renderer is the main rendering module. It is responsible for fast, efficient rendering of the layout built by the layout engine. All graphics functions are optimized to provide an effective experience to the user navigating a document.

Print Renderer

Like the screen renderer, the print renderer uses the DOM, CSS, and layout information representing the document. The print renderer takes care of page breaking within images, tables, and table cells. This renderer does not depend on any particular printing API. It is compatible with JDK1.1.8, Java 2 printing APIs, and any third-party, customer-required API.

The pilot exposes its capabilities to the scripter through a script driver, allowing scripts written for the scripter to control various parts of the pilot, such as a different window. For example, the HTML 4 pilot exposes the DOM representation to JavaScript.



Copyright 2005. ICEsoft Technologies, Inc.
http://www.icesoft.com

TOC PREV NEXT INDEX