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
[EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
