You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by monkeyiq <mo...@users.sourceforge.net> on 2002/01/16 12:47:09 UTC

Wrapping an API in a DOM_Document.

Hi,
  I am the author of ferris
( http://witme.sourceforge.net/libferris.web/index.html )
and have wrapped its API in a DOM using

DOM_DOMImplementation impl;
DOM_Document doc = impl.createDocument(...);
DOM_Element e = doc.getDocumentElement();

/* for all the nodes in the tree, add to 'e' or another element */
        childe = ...;
        e.appendChild(childe);

The obvious drawback of this is that all the attributes and elements
need to be known at creation time. I would like to stick to the DOM
API instead of the SAX API mainly because I am more familiar with DOM
and have used it in XSLT operations.

I would very much like to make atleast DOM_Element objects a custom
class so that the DOM wrapper can store smart pointers to my VFS
abstractions and get data only when it is asked for. This would also
allow me to wrap the enitre / filesystem as a DOM and access any parts
of it using XSLT.

>>From looking at the API docs it appears that I need to:
create a custom DOM_DOMImplementation class,
create a DOM_Document subclass that allows be to attach my custom
DOM_FerrisElement objects, 
    DOM_Element createFerrisElement( 
        const DOMString &tagName, 
        fh_context ferrisVfsAbstraction );

At the DOM_Document level I start running into problems because
I can not really use DocumentImpl to delegate all my work. So
as far as I can tell I need to write a whole new DOM_Document
implementation and maybe some other node based stuff that is 
not related to the goal of having a lazy initialization in
DOM_Element objects.

Any thoughts on other approaches to this or ideas?

-- 
-----------------------------------------------------
http://witme.sourceforge.net/libferris.web/index.html


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org