| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <html> |
| <head> |
| <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>Read DOM Session Transformer</title> |
| <link href="http://purl.org/DC/elements/1.0/" rel="schema.DC"> |
| <meta content="Carsten Ziegeler" name="DC.Creator"> |
| <meta content="Sven Beauprez" name="DC.Creator"> |
| <meta content="Davanum Srinivas" name="DC.Creator"> |
| <meta content="This document describes the read dom session transformer of Cocoon." name="DC.Description"> |
| </head> |
| <body> |
| |
| <h1>Read DOM Session Transformer</h1> |
| |
| <p>With this transformer, a DOM-object that is stored in the session, can be inserted |
| in the SAX stream at a given position.</p> |
| |
| <ul> |
| |
| <li>Name : readDOMsession</li> |
| |
| <li>Class: org.apache.cocoon.transformation.ReadDOMSessionTransformer</li> |
| |
| <li>Cacheable: no.</li> |
| |
| </ul> |
| |
| <p> |
| Simply transforms a DOM to SAX-events, which can be used further on in the |
| pipeline. Once you stored the result of a query in the session with the |
| WriteDOMSessionTransformer, you can read it again with the |
| ReadDOMSessionTransformer: |
| </p> |
| |
| |
| <pre class="code"> |
| |
| <map:transform type="readDOMsession"> |
| <map:parameter name="dom-name" value="DBresult"/> |
| <map:parameter name="trigger-element" value="users"/> |
| <map:parameter name="position" value="after"/> |
| </map:transform> |
| |
| </pre> |
| |
| |
| <p> |
| In this example, the SAX-events that came from the DOM tree that is stored in |
| the session with name DBresult will be added after the users element. This means |
| as soon that the transformer encounters the end-element 'users', it will start |
| to generate SAX-events from the DOM tree. There are three possible positions, |
| 'before','in' and 'after': |
| </p> |
| |
| <ol> |
| |
| <li>'before' means that when the transformer encounters the 'users' element, it |
| will FIRST translate the DOM tree to SAX-events and THEN it will continue to |
| forward the other SAX-events (starting with 'users'). |
| </li> |
| |
| <li>'in' means that the transformer will forward the startElement event for |
| 'users' and that it IMMEDIATELY starts to generate SAX-events from the DOM-tree. |
| After that, it will continue to forward the child elements of users and then all |
| the other elements. |
| </li> |
| |
| <li>'after' means that the transformer starts to generate SAX-events from the |
| DOM-tree just after it has forwarded the end-element 'users'. |
| </li> |
| |
| </ol> |
| |
| <p> |
| The ReadDOMSessionTransformer is a standalone component, you don't need to use |
| it in combination with the WriteDOMSessionTransformer. |
| </p> |
| |
| |
| </body> |
| </html> |