You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by PF...@cch.com.au on 2004/09/21 01:07:17 UTC

DTM

Hi,

I'm new to this list, so I apologize if this is the wrong place to post
this
message. If it is the wrong place, then could you please tell me where I
should be asking these questions?

I'm trying to get Xalan-J to work with a Persistent DOM. As such, all the
nodes of the DOM are not in memory at the same time and are only
loaded when required. In my DOM implementation, no references
are kept to the node so the Java GC can remove un-referenced
nodes.

When I run the DOM thought Xalan the nodes to not get GC and I think
this is due to the DTM module maintaining references to the nodes.
Also, it appears to go though the DOM serially (does this sound right).

My questions are...

1. If there a way to replace DTM in a DOM by DOM basis (i.e. for a
normal XML document the normal DTM is used) and for my DOM
I can use my own implementation without modifying the Xalan source
code.

2. Can you point me at any information of implementing my own
DTM interface (other that the source code).

3. Do you think this is a pointless exercise and should I try
another processor (I'd rather not)?

Thanks for you help.






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


Re: DTM

Posted by Joseph Kesselman <ke...@us.ibm.com>.



>There is no formal interface that allows you to
>supply a vendor specific source.

Actually, I think there is. The DTM Manager class should be being selected
at runtime based on a property in the environment. (See
DTMManager.newInstance().) That can be overridden in the usual ways --
create a properties file which asserts your new defaults, or use the JVM's
-D option, or set the property explicitly in your front-end code before
calling the Xalan APIs.

This would let you plug in your own DTMManager which supports additional
kinds of Source and/or which routes the Sources to different DTM loading
processes/implementations. I've done this on occasion when prototyping
code, usually by either copying or subclassing DTMManagerDefault.


DTMs (and therefore DOM2DTM's references to a DOM) persist as long as the
DTMManager persists, unless the DTMManager is explicitly told to release
them. The simplest solution to flushing the cache is simply to discard the
higher-level Xalan transformer object and request a new one.


DOM2DTM is designed for DOMs which will not be altered after their DTM
proxy has been created. There's an experimental DOM2DTM2 class which
maintains less local information and thus is able to track changes made to
the DOM between transformation/XPath calls... but it requires some features
that aren't supported by all DOMs, and we never finished cleaning it up and
trying to make it performant.

I believe our long-term approach is going to be something derived from the
XDM sketch (at the document-model API level, anyway; the back end is likely
to still be DTM in many cases).

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk


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


Re: DTM

Posted by John Gentilin <ge...@eyecatching.com>.
The DOM2DTM code will walk you DOM implementation and capture references to
the internal nodes. 

Q1, You can and you can't, there is no formal interface that allows you to supply 
a vendor specific source. i.e. Transformer only supports Stream, SAX, DOM sources. 
So even if you wrote you own DTM impl, there is no way to pass it in through the 
transformer unless you modify the interface to allow native DTM sources to be 
supplied. With that said, you are not out of options. What you could do is write 
DTM interface for your DOM implementation, then reach that data internally using 
a variable. If you look at the SQL Extension example and the source, you will see
that I implemented a JDBC ResultSet to DTM interface. It is probably your best 
starting point, you could build from DTMDocument as you base class. The source
is not all that complicated, I would start looking at the SQLDocument. This class
does the specific work of coupling the ResultSet to a DTM, and DTMDocument does the
bulk of supporting a DTM for an abstract object.

Its a bit messy, referencing your input document from a variable but you could ease
the pain a bit by implementing a SAXSource that will double as an extension element.
The code would accept the SystemID as the file to build your DTM around, but it will
only provide an empty XML document to the transformer, enough to satisfy the root
template. The in the root template, apply-templates to the extension element portion
which will return your real DTM.

i.e.
 SAXSource source = new au.com.cch.MySAXSource("filename"):
 transform(source, result);

then in your root template
 xmlns:MySAXSource="au.com.cch.MySAXSource" 

 <xsl:template match="/">
   <xsl:apply-templates select="MySAXSource:getDocument()" />
  </xsl:template>

Where getDocument is a static method which will return the Custom DOM -> DTM implementation
for the current thread.

HTH
John G

PFinch@cch.com.au wrote:

> Hi,
> 
> I'm new to this list, so I apologize if this is the wrong place to post
> this
> message. If it is the wrong place, then could you please tell me where I
> should be asking these questions?
> 
> I'm trying to get Xalan-J to work with a Persistent DOM. As such, all the
> nodes of the DOM are not in memory at the same time and are only
> loaded when required. In my DOM implementation, no references
> are kept to the node so the Java GC can remove un-referenced
> nodes.
> 
> When I run the DOM thought Xalan the nodes to not get GC and I think
> this is due to the DTM module maintaining references to the nodes.
> Also, it appears to go though the DOM serially (does this sound right).
> 
> My questions are...
> 
> 1. If there a way to replace DTM in a DOM by DOM basis (i.e. for a
> normal XML document the normal DTM is used) and for my DOM
> I can use my own implementation without modifying the Xalan source
> code.
> 
> 2. Can you point me at any information of implementing my own
> DTM interface (other that the source code).
> 
> 3. Do you think this is a pointless exercise and should I try
> another processor (I'd rather not)?
> 
> Thanks for you help.
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xalan-dev-help@xml.apache.org





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