You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Lars Martin <la...@softwarebuero.de> on 2000/07/27 15:32:23 UTC

Are these instanceof's really necessary? [longer]

Hi all,

I just downloaded the Xerces 1.1.3 source distribution to have a look at it and
to see the possibilities tu use it for our OS project ozoneXML
(http://www.ozone-db.org) - a persistent XML engine. Until now we used Xerces-J
only for XML parsing but used a patched OpenXML implementation for persistency.
Because OpenXML is not any longer maintained (?), it is not the fastest
implementation and so on, we would like to replace it by newer implementations
and would like to use Xerces for parsing _and_ persistency.

The user should be able to use any DOM implementation (Xerces, Oracle, OpenXML
or whatever) and we don't want to patch these implementations to extend DOM
nodes with database capabilities as we did with the old OpenXML implementation.
For this we introduced an additional layer which wrapps the native DOM
implementation, offers database persistency and implements the W3C DOM Level 2
interfaces. So the user can use any XML tool to work with these persistent
nodes. The next small picture may illustrate the architecture.

client application <------------------------------->database server

Node Wrapper <------------- proxy link ---------->  native DOM Node

Everything works fine, the NodeWrapper hides the Xerces Node and returns the
correct values, e.g. the right document owner which is necessary to append
childs. But there is a other big problems, source code like

    if (!(newNode instanceof NodeImpl))
           throw new DOMExceptionImpl (...)

doesn't fit into this architecture because our NodeWrapper is no instance of
the Xerces dependend NodeImpl. So my question is, is it really necessary to
do such implementation specific things? Is the W3C interface not enough? Are
there any other solutions?

Thanks in advance,
Lars
-- 
________________________________________________________________
Lars Martin                                lars@softwarebuero.de
SMB GmbH                             http://www.softwarebuero.de