The Mozilla
Organization
At A Glance
Feedback
Get Involved
Newsgroups
License Terms
Newsbot
Developer Docs
Roadmap
Projects
Ports
Module Owners
Hacking
Get the Source
Build It
Testing
Download
Bugzilla
Bug Writing
Tools
View Source
Tree Status
New Checkins
Submit A Bug
FAQ
Search

Java DOM API
by Akhil Arora <akhil.arora@sun.com>

The Java DOM API is part of the Blackwood project. It is an implementation of the Java bindings specified in Document Object Model (DOM) Level 1 Specification. Only the core DOM interfaces are implemented.

  • Why?

  • The primary purpose of the Java DOM API is to allow Java Applets and Pluglets to interact with and modify the document they are embedded into. An Applet, for example, need not even have a display area, it can do its work solely through DOM manipulations.

  • How?

  • The Java DOM API is written as a very thin layer on top of the C++ coreDOM API using JNI. Each Java object delegates all method calls to the corresponding C++ coreDOM object.

  • Using the API

  • The API is intended to be used by Java Applets, Java Pluglets and Java Applications that embed Gecko. Some important things to keep in mind when using the API are listed below.

    • Thread safety

    • It is only safe to access and manipulate the DOM from within a method of the DocumentLoadListener interface, since these calls are made from the main layout thread. Trying to access or manipulate the DOM from any other thread is unsafe. We may be able to work around this limitation using nsISupports Proxies.

    • Null returns

    • API users need to check for null returns from methods such as Node.getAttributes(). If a node does not have any attributes, a null object will be returned, instead of an empty NamedNodeMap with zero elements, in accordance with the spec.

Copyright © 1998-2000 The Mozilla Organization.
Last modified August 9, 1999.