You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Yuri de Wit <yu...@metaserver.com> on 2003/04/29 01:30:34 UTC

Extension Element to Optimize Large XML transformations

Hi All, 
 
I am considering using an extension element that semantically has the same
function and syntax as the xsl:copy-of but instead of creating a copy of the
source tree (or subtree) into the resulting tree it would copy it "by
reference" avoding expensive memory allocations.
 
I already created the extension element and the means of knowing whether the
result element returned by the select attribute should be copied by value or
by reference, however I need some help regarding how to use the extension,
template and xpath classes in xalan to accomplish that. 
 
Is it possible to, from within an extension element reuse the
ElemCopyOf.execute() method for when copy by value is good enough? How can I
do that?
If not, how can I implement the same functionality inside the extension
element implementation?
Are there any code samples that could guide me in this?
Isnt that something that could be incorporated by Xalan in order to improve
its performance?
 
As a side note, It seems to me that Xalan should also support
transformations directly on top of object models other than DOM, SAX, or
Streaming in the same way that Werken XPath engine does. In such pluggable
architecture the DTM, DOM, or SAX could be just different implementations
(in some through adapters) of a public DTM API and I would be able to plug
my own custom object model directly into xalan.
 
Thanks, 
 
Yuri

Re: Extension Element to Optimize Large XML transformations

Posted by da...@us.ibm.com.



Why do you assume copy-of makes an in-memory copy of the source tree to add
to the result tree?  More importantly, why do you assume the processor
actually creates a result tree?  As far as I know, Xalan-J doesn't create a
result tree when the target of the transformation is serialized XML.  If
your transformation target is an instance of the DOM, then you've got
bigger performance issues than just worrying about xsl:copy-of.

The only time the processor creates copies in memory is when your
stylesheet creates a result tree fragment.  It might be useful if you
posted a sample stylesheet which you think will be optimized by this
extension element.

Dave



|---------+--------------------------->
|         |           Yuri de Wit     |
|         |           <yuri.dewit@meta|
|         |           server.com>     |
|         |                           |
|         |           04/28/2003 04:30|
|         |           PM              |
|         |           Please respond  |
|         |           to xalan-dev    |
|---------+--------------------------->
  >----------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                                  |
  |        To:      "'xalan-dev@xml.apache.org'" <xa...@xml.apache.org>                                                          |
  |        cc:      (bcc: David N Bertoni/Cambridge/IBM)                                                                             |
  |        Subject: Extension Element to Optimize Large XML transformations                                                          |
  >----------------------------------------------------------------------------------------------------------------------------------|



Hi All,

I am considering using an extension element that semantically has the same
function and syntax as the xsl:copy-of but instead of creating a copy of
the source tree (or subtree) into the resulting tree it would copy it "by
reference" avoding expensive memory allocations.

I already created the extension element and the means of knowing whether
the result element returned by the select attribute should be copied by
value or by reference, however I need some help regarding how to use the
extension, template and xpath classes in xalan to accomplish that.

Is it possible to, from within an extension element reuse the
ElemCopyOf.execute() method for when copy by value is good enough? How can
I do that?
If not, how can I implement the same functionality inside the extension
element implementation?
Are there any code samples that could guide me in this?
Isnt that something that could be incorporated by Xalan in order to improve
its performance?

As a side note, It seems to me that Xalan should also support
transformations directly on top of object models other than DOM, SAX, or
Streaming in the same way that Werken XPath engine does. In such pluggable
architecture the DTM, DOM, or SAX could be just different implementations
(in some through adapters) of a public DTM API and I would be able to plug
my own custom object model directly into xalan.

Thanks,

Yuri