Re: How to get Java to use DOM?

Mark Stephen Krueger wrote:

> Hi,
>
> I searched the archives for answers to these questions, but I was unable to
> find any:
>
> I would like to be able to control the DOM of a browser's current HTML page
> from an embedded Java applet.  Can this be done?  How is this done?

Well, it can be done, but you will need to use different scripting interfaces
for each browser's object model. JavaScript can invoke access public properties
and invoke public methods of a Java applet. It can pass to and receive from the
applet strings, numbers and booleans. However, dealing with objects like arrays
or dates gets really tricky. For that you'd need to resort to environment
specific techniques - LiveConnect in Navigator and ActivcX in IE.

Another approach is to use the JavaScript implementation of FreeDOM for which
there is now a W3C DOM compliant version in beta. There is an article about
FreeDOM on Builder.com at:

http://builder.cnet.com/Programming/FreeDOM2/

You can use FreeDOM to insulate your applet from the differences between browser
DOMs, or depending on your application you may find that you don't need to use
Java as FreeDOM provides you with a object-oriented framework for application
processing.  You can use the JavaScript xparse tool to parse XML and someone has
written a method to generate FreeDOM objects from xparse results. Also, be aware
that there may be objects needed by your app in the browser environment(like
window, navigator and others) which the W3C DOM spec does not cover.
<DISCLAIMER>I am the creator of FreeDOM</DISCLAIMER>

>
>
> Some information I have come across seems to imply that this is
> implementation dependent.  If this is true, does anyone have pointers on how
> to do this in Microsoft's and Netscape's browsers?  If these implementations
> are different, which one is leaning toward being the standard (if any)?
>

With version 5, both browsers provide W3C DOM support. However, you should
realized that Events, CSS and other issues are still not pinned down and that
you'll still have deal with the differences in interfacing to Java.

Hope this helps,
Laurence

>
> If Java cannot access the DOM of the browser's current page, can JavaScript
> be made to talk with an applet (so that the JavaScript can then manipulate
> the DOM for the applet)?  Can an applet send events back to JavaScript?  If
> this is implementation dependent, does anyone have pointers to how to do
> this in Microsoft's and Netscape's browsers?  If this is currently
> proprietary, is there any move toward a standard on this front?

>
>
> I apologies if this is a FAQ and I just missed it in the archives somehow.
> I would think this would be something people would often want to do.  I was
> surprised that I couldn't find anything on it.
>
> Thanks,
> Mark Stephen Krueger - Software Engineer
> Marquette Medical Systems
> <mailto:mark.krueger@mail.mei.com>
>

Received on Monday, 8 February 1999 18:07:22 UTC