[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: JAXP and Java XML APIs (was RE: [xml-dev] difference bet. xercesand crimson)
- From: Justin Couch <firstname.lastname@example.org>
- To: Xml-Dev <email@example.com>
- Date: Thu, 27 Sep 2001 12:41:21 +1000
"Champion, Mike" wrote:
> I'd be very interested in hearing a more detailed explanation of the
> "difficulty in the DOM model". (I'm hopelessly biased, having spent the
> last four years on the DOM WG -- but trying to be open minded!).
I'll throw in my US $0.02 (which, given our exchange rates is my yearly
as someone who's had to implement the W3C DOM Level 2 interfaces,
including event model.
> - Text nodes (a nice hack for mixed content, just another hassle everywhere
> - CDATA sections (the InfoSet, perhaps wisely, treats them as syntax sugar)
No real problems here. Just keep everything as a string. Combining them
is a bit of a bitch sometimes, but nothing too difficult.
> - The fact that entity reference nodes are exposed in the tree rather than
> being hidden (again, the InfoSet probably did it right ... but the DOM WG
> couldn't figure out a clean way to both hide entity references from
> "browsers" and expose them to "editors").
Actually, we would prefer to expose the entity typing information. For
example, the X3D spec uses entities for typing very heavily and that
sort of stuff being k own at the DOM level would be really useful.
Unfortunately, SAX doesn't give that to us, so we're stuffed anyway.
> - The long delay in support for a query mechanism other than
Yup. Actually, I hate getElementsByName() - in particular the recursive
nature of it. eg Having a Document and then getElementsByName() of some
nested element waaay down in the heirarchy where you have to go search
for the instances.
> - All the stuff in Java that's not in generic CORBA IDL. (There's not a
> whole lot the DOM WG could do about this, is there? Maybe the Java bindings
> could have exploited Java-isms more???)
Actually, my real bitch is that DOM/IDL doesn't seem to think that the
rest of the world exists. For example, naming interfaces as "Event"
rather than DOMEvent and similar causes a lot of implemenation hassles
when you are inside an environment that has many other things of the
same name. For example, within Xj3D, we have "event" objects for DOM,
VRML97 scripting, VRML97 external authoring, Swing stuff (For UIs that
render DOM trees for example) as well as our own internal systems of the
browser. That causes a lot of ugliness in the implemenation code as we
have to try to workout what namespace a class comes from, and in a
number of cases, deal with name clashes (methods of the same name from
different interfaces returning different values but with the same
parameter list). In some cases, this has lead us to having to create
separate class instances when is it much more efficient if we had
everything together as a single class.
Another bitch is the way that DOM just lumps everything into the one
interface. If I get a DOM Document instance, I have no way of knowing
whether we're using Level 1, Level 2 or Level 3 capabilities. For
example, in Xj3D we'd like to use DOM Level 3, but can't because the JDK
pre-packages only level 2 interfaces as part of the standard
distribution. There's no (reasonable) way we can use the level 3
interfaces without fucking with the client's JVM setup, which is a
_really, really_ bad thing to do. These interfaces should have had
naming conventions so that each level is clearly marked and discreet and
can be *layered* over the existing interfaces. That is, Document,
Document2, Document3 for the capabilities of each level. Today, using
DOM Level 3 within a Java application is for all intents and purposes,
Justin Couch http://www.vlc.com.au/~justin/
Freelance Java Consultant http://www.yumetech.com/
Author, Java 3D FAQ Maintainer http://www.j3d.org/
"Humanism is dead. Animals think, feel; so do machines now.
Neither man nor woman is the measure of all things. Every organism
processes data according to its domain, its environment; you, with
all your brains, would be useless in a mouse's universe..."
- Greg Bear, Slant