W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2000

Re: Novice Java Language Binding Question

From: Stephen R. Savitzky <steve@rsv.ricoh.com>
Date: 27 Jan 2000 14:41:01 -0800
To: <www-dom@w3.org>
Message-ID: <qczotr2l4y.fsf@congo.crc.ricoh.com>
"John Duffy" <jbduffy@cwcom.net> writes:

> I have downloaded, and printed, the DOM Level 1 Spec and think I have 
> got the general idea.  Also, I have downloaded the Java-bindings.zip file
> and have amended my  CLASSPATH to point to the class files.
> 
> My question is, how do I actually USE the Java Bindings classes?  I don' t
> mean how do I use the interfaces, but how do I get access to  the
> interfaces from within Java.  Do I need to import the classes, or
> something?

1. Obtain an _implementation_ of the Java bindings.  Try looking around
   <http://xml.apache.org>, for example. 

2. The implementation will normally come with a parser that constructs a
   DOM parse tree from a document read from a file.

3. In your application, import the implementation's parser class, and also
   the DOM interfaces, using (for example)

   import org.w3c.dom.*;

4. Do whatever it takes to run the implementation's parser over a file.
   This will eventually return an org.w3c.Document object, to which you can
   then apply the various methods given in the DOM spec. 

DOM level 1 specifies what you can do with a Document once you have it, but
says nothing about how you can obtain a Document in the first place.  It
also says nothing about how you convert from a DOM tree back to text, if
that's what you want to do.

> Ultimately, I want to be able to dynamically alter an HTML document =
> using the HTML Bindings.

You may have trouble finding a Java implementation for the HTML interfaces;
I think that most freestanding implementations only implement the core.  If
you want to do this inside of a browser, you may be out of luck -- I'm not
sure whether applets are given access to their enclosing document.  If they
were, it would probably give rise to some rather interesting security holes.

-- 
Stephen R. Savitzky  <steve@rsv.ricoh.com>  <http://rsv.ricoh.com/~steve/>
Platform for Information Applications:      <http://RiSource.org/PIA/>
Chief Software Scientist, Ricoh Silicon Valley, Inc. Calif. Research Center
 voice: 650.496.5710  front desk: 650.496.5700  fax: 650.854.8740 
  home: <steve@theStarport.org> URL: http://theStarport.org/people/steve/
Received on Thursday, 27 January 2000 17:42:03 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:47 GMT