W3C home > Mailing lists > Public > www-dom@w3.org > October to December 1999

Re: Any reason that the Level 2 interfaces have the EXACT SAME NAME a sthe Level 1 interfaces?

From: David Brownell <david-b@pacbell.net>
Date: Tue, 26 Oct 1999 21:22:06 -0700
Message-ID: <38167DEE.7513AF6D@pacbell.net>
To: "Box, Don" <dbox@develop.com>
Cc: "'www-dom@w3.org'" <www-dom@w3.org>
"Box, Don" wrote:
> This makes it extremely hard to write Java code that:
> a) Allows users to link in their own XML parser that implements org.w3c.*
> b) Mixes Level 1 and Level 2 XML parsers in the same VM.

(Not that DOM is a parser API -- you can't feed it text and get a Document
back without using proprietary APIs -- but I know what you mean since I
recently tripped over this myself.)

I think the short answer is "use JDK 1.2 not JDK 1.1".

The semantics of interface evolution changed a bit in there.  As of 1.2
it's OK to change an interface.  (You're not damned for all time when you
goof, unless it's a _really evil_ goof :-)  The error is only when someone
invokes interface methods that the implementation doesn't support.

I recently tripped over a similar problem.  Using the Jakarta.Apache.ORG
servlet engine with a JDK 1.1.8 JVM, kablooie:  some code that created
a DOM L1 "Document" object failed on startup because it wouldn't work when
the DOM L2 interface classfiles (and my DOM2 implementation) were before
it in the classpath.  Wrong answer; I needed to use those L2 features,
and they weren't accessible that way!

Switch over to a 1.2 JVM, it started fine -- even with L2 classfiles first.

Just use DOMImplementation.hasFeature("XML","2.0") to see if it's safe
to call those new methods.

- Dave

p.s. This confirms what Ray said ("works on 1.2") but the twist is
	that there was no bug in 1.1 -- it was a spec change, as
	appropriate for a major relase.  The marketers weren't
	completely offbase to call it "Java 2" -- not 100% anyway!
Received on Wednesday, 27 October 1999 00:22:08 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:06 UTC