I could, but it's _extremely_ complex, and is very specific to some of the
quirks of the Xerces DOM. So, unless your DOM has those same quirks, you
might end up with more complexity than you need.
The basic issues for wrapping your DOM are:
1. Creating proxy nodes that implement the XalanDOM interfaces.
2. Deciding on a strategy for mapping between your DOM nodes and the
proxy nodes. The Xerces bridge does it two ways: the first is through
a class which maps between the two kinds of nodes
(XercesToXalanNodeMap), or through pointers kept in the proxy nodes
(XercesBridgeNavigator). Mapping uses less memory and will work if the
DOM is modified, while the navigator uses more memory, but has much
better performance.
3. Creating a pool of strings so your nodes can return XalanDOMStrings
instead of whatever string type your DOM returns. You can use
XalanDOMStringPool to implement this, if the strings from your DOM are
null-terminated arrays of UTF-16 code points.
One thing you might do to better understand what's going on is to step
through the code in your favorite debugger as it's executing. That's
always a great way to start figuring things out. I could also answer
specific questions as you start to investigate the code and your solution.
One the other hand, you might want to consider doing operations on your
DOM, then translating to Xalan's internal source tree to do the
transformation. That would work well if your processing model involves
building and manipulating a DOM, then transforming it once. If your model
involves manipulating and transforming multiple times, then it probably
would be better to do a bridge.
Dave
nirmalts
<nirmalts@yahoo. To: [EMAIL PROTECTED]
com> cc: (bcc: David N
Bertoni/Cambridge/IBM)
Subject: DOM Bridge
08/29/2002 11:19
PM
Please respond
to xalan-dev
Hi
I have a DOM tree in memory (not created by Xerces-C),
which I want to give as input to Xalan-C. Since the
DOM is lil different from Xalan DOM I am thinking of
constructing a bridge like its done for Xerces DOM in
Xalan. But looking into the Xerces bridge, I find it
very confusing. I could not really make out the
functionalities of classes like XercesBridgeNavigator,
XercesBridgeHelper, XercesTreeWalker etc. Can some one
explain to me how this bridge works so that I can
implement a similiar bridge for my DOM.
Thanks
Nirmal
__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com