You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Andrzej Jan Taramina <an...@chaeron.com> on 2003/10/19 00:31:31 UTC
New ReadDOMTransformer/WriteDOMTransformer available.
The existing Read/WriteDOMSessionTransformer was limited to reading/writing
to sessions only. I didn't really like this behaviour, since there are times
you only want to store stuff for the duration of a request, and thus not have
it get serialized to a persistent store (eg. by Tomcat) if you forget to
invalidate the session or delete the DOM object (deletion currently being
problematic with Cocoon).
So I wrote new ReadDOMTransformer and WriteDOMTransformer classes that take
an extra parameter specifying whether to read from/write to the session or
the request instead. Default is to write to a session to stay more or less
compatible with the older versions.
Usage notes for the WriteDOMTransfomer:
* Make a DOM object from SAX events and write it to the session or request.
*
* This transformer is based on the original WriteDOMSessionTransformer, but
has been made
* consistent in it's parameter naming and internal structure with the
corresponding
* ReadDOMTransformer.
*
* Usage in sitemap:
* <map:transform type="writeDOM">
* <map:parameter name="write-to" value="request">
* <map:parameter name="attribute-name" value="companyInfo">
* <map:parameter name="dom-root-element" value="companies">
* </map:transform>
*
* Where:
* write-to specifies whether to write to the session or request (default:
session )
* attribute-name is the name for the DOM object in the session or request
* dom-root-element is the trigger that will be the root element of the DOM
Usage notes for the ReadDOMTransfomer:
* With this transformer, an object that is stored in the session or request,
can be inserted
* in the SAX stream at a given position, using usual <xsp:expr> rules.
* Object can be DOM Node, XMLizable, or any other object supported by
<xsp:expr>.
*
* This transformer is based on the original ReadDOMSessionTransformer, but
has been made
* consistent in it's parameter naming and internal structure with the
corresponding
* WriteDOMTransformer.
*
* Usage in sitemap:
* <map:transform type="read-DOM">
* <map:parameter name="read-from" value="request"/>
* <map:parameter name="attribute-name" value="companyInfo"/>
* <map:parameter name="trigger-element" value="company"/>
* <map:parameter name="position" value="after"/>
* </map:transform>
* </pre>
*
* Where:
* read-from specifies whether to read from the session or request (default:
session )
* attribute-name is the name of the object in the session/request
* trigger-element is the element that we need to insert the SAX events
* postion is the actual place where the stream will be inserted, ie before,
after or in
* the trigger-element
And you need to add the transformer entries to your sitemap as follows:
<map:transformer name="writeDOM"
src="org.apache.cocoon.transformation.WriteDOMTransformer"
logger="sitemap.transformer.writeDOM"/>
<map:transformer name="readDOM"
src="org.apache.cocoon.transformation.ReadDOMTransformer"
logger="sitemap.transformer.readDOM"/>
Because WriteDOMTransformer parameters were made consistent with the
ReadDOMTransformer,
it's not a direct drop-in replacement for the older
WriteDOMSessionTransformer (it now uses the "attribute-name" parameter
instead of the prior "dom-name parameter" which was misnamed,
IMNSHO).
Anyhow....available in source for any/all who might want it.
Maybe a Cocoon submitter can take the code and include it in the upcoming
2.1.3 release?
Enjoy!
Andrzej Jan Taramina
Chaeron Corporation: Enterprise System Solutions
http://www.chaeron.com
Re: New ReadDOMTransformer/WriteDOMTransformer available.
Posted by Andrzej Jan Taramina <an...@chaeron.com>.
Joerg asked:
> Please add it to Bugzilla (http://nagoya.apache.org/buzilla/).
That should be: http://nagoya.apache.org/bugzilla ;-)
Done! Bug number is 23921, source code posted as well.
Andrzej Jan Taramina
Chaeron Corporation: Enterprise System Solutions
http://www.chaeron.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: New ReadDOMTransformer/WriteDOMTransformer available.
Posted by Andrzej Jan Taramina <an...@chaeron.com>.
Joerg asked:
> Please add it to Bugzilla (http://nagoya.apache.org/buzilla/).
That should be: http://nagoya.apache.org/bugzilla ;-)
Done! Bug number is 23921, source code posted as well.
Andrzej Jan Taramina
Chaeron Corporation: Enterprise System Solutions
http://www.chaeron.com
Re: New ReadDOMTransformer/WriteDOMTransformer available.
Posted by Joerg Heinicke <jh...@virbus.de>.
Please add it to Bugzilla (http://nagoya.apache.org/buzilla/).
Thanks,
Joerg
On 19.10.2003 00:31, Andrzej Jan Taramina wrote:
> The existing Read/WriteDOMSessionTransformer was limited to reading/writing
> to sessions only. I didn't really like this behaviour, since there are times
> you only want to store stuff for the duration of a request, and thus not have
> it get serialized to a persistent store (eg. by Tomcat) if you forget to
> invalidate the session or delete the DOM object (deletion currently being
> problematic with Cocoon).
>
> So I wrote new ReadDOMTransformer and WriteDOMTransformer classes that take
> an extra parameter specifying whether to read from/write to the session or
> the request instead. Default is to write to a session to stay more or less
> compatible with the older versions.
>
> Usage notes for the WriteDOMTransfomer:
>
> * Make a DOM object from SAX events and write it to the session or request.
> *
> * This transformer is based on the original WriteDOMSessionTransformer, but
> has been made
> * consistent in it's parameter naming and internal structure with the
> corresponding
> * ReadDOMTransformer.
> *
> * Usage in sitemap:
> * <map:transform type="writeDOM">
> * <map:parameter name="write-to" value="request">
> * <map:parameter name="attribute-name" value="companyInfo">
> * <map:parameter name="dom-root-element" value="companies">
> * </map:transform>
> *
> * Where:
> * write-to specifies whether to write to the session or request (default:
> session )
> * attribute-name is the name for the DOM object in the session or request
> * dom-root-element is the trigger that will be the root element of the DOM
>
> Usage notes for the ReadDOMTransfomer:
>
> * With this transformer, an object that is stored in the session or request,
> can be inserted
> * in the SAX stream at a given position, using usual <xsp:expr> rules.
> * Object can be DOM Node, XMLizable, or any other object supported by
> <xsp:expr>.
> *
> * This transformer is based on the original ReadDOMSessionTransformer, but
> has been made
> * consistent in it's parameter naming and internal structure with the
> corresponding
> * WriteDOMTransformer.
> *
> * Usage in sitemap:
> * <map:transform type="read-DOM">
> * <map:parameter name="read-from" value="request"/>
> * <map:parameter name="attribute-name" value="companyInfo"/>
> * <map:parameter name="trigger-element" value="company"/>
> * <map:parameter name="position" value="after"/>
> * </map:transform>
> * </pre>
> *
> * Where:
> * read-from specifies whether to read from the session or request (default:
> session )
> * attribute-name is the name of the object in the session/request
> * trigger-element is the element that we need to insert the SAX events
> * postion is the actual place where the stream will be inserted, ie before,
> after or in
> * the trigger-element
>
> And you need to add the transformer entries to your sitemap as follows:
>
> <map:transformer name="writeDOM"
> src="org.apache.cocoon.transformation.WriteDOMTransformer"
> logger="sitemap.transformer.writeDOM"/>
>
> <map:transformer name="readDOM"
> src="org.apache.cocoon.transformation.ReadDOMTransformer"
> logger="sitemap.transformer.readDOM"/>
>
> Because WriteDOMTransformer parameters were made consistent with the
> ReadDOMTransformer,
> it's not a direct drop-in replacement for the older
> WriteDOMSessionTransformer (it now uses the "attribute-name" parameter
> instead of the prior "dom-name parameter" which was misnamed,
> IMNSHO).
>
> Anyhow....available in source for any/all who might want it.
>
> Maybe a Cocoon submitter can take the code and include it in the upcoming
> 2.1.3 release?
>
> Enjoy!
>
>
> Andrzej Jan Taramina
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org