You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Wermus Fernando <fe...@xlnet.net.ar> on 2004/03/04 18:00:41 UTC

calling from a component made by my own to a transformer.

I can't figure out how to call another component. In my case, I want to
call xmlhttp component, but It's the same for any transformer...., I
guess


Here is my code.


package myGenerators;

import org.apache.avalon.excalibur.pool.Poolable;
import org.apache.cocoon.components.parser.Parser;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.environment.Source;
import org.apache.cocoon.transformation.Transformer;
import org.apache.cocoon.generation.ComposerGenerator;
import org.apache.avalon.framework.component.Component;
import com.clsw.cocoon.XmlHttpTransformer;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import java.io.ByteArrayInputStream;
import java.io.IOException;


public class ZipGenerator extends ComposerGenerator implements Poolable{
	private XmlHttpTransformer trans = null;

	public void generate() 
		throws SAXException, IOException, ProcessingException { 
			
			String xmlURI = this.source;
			Source archive = null;
			Parser parser= null;
			try { 
				archive = this.resolver.resolve( xmlURI
);				
				InputSource inputSource =
archive.getInputSource();				
				parser = (Parser) this.manager.lookup
(Parser.ROLE);
				//parser.setConsumer( this.xmlConsumer
); //con xmlConsumer no funca
				trans = (XmlHttpTransformer)
this.manager.lookup (XmlHttpTransformer.ROLE);				
	
trans.setContentHandler(this.contentHandler);
				
	
parser.setContentHandler((xmlConsumer)trans);
				parser.parse( inputSource );		
			}	 
			catch (ComponentException ce) { 
			 			throw new
ProcessingException("Component Parser not found.", ce); 
			}
			finally { 
				if (archive != null) 
					archive.recycle();
			}
			   	 
		}
}

-----Mensaje original-----
De: beyaRecords - The home Urban music [mailto:uzo@beya-records.com] 
Enviado el: jueves, 04 de marzo de 2004 13:35
Para: users@cocoon.apache.org
Asunto: Re: Passing values into an XSP logic sheet

Christopher,
that works fine now ;-)

many thanks


Andrew
On 4 Mar 2004, at 16:00, Christopher Painter-Wakefield wrote:

> <xsl:template match="artistDetails:get-details">
>       <xsp:logic>
>             int artistID = Integer.parseInt(<xsl:apply-templates
> select="artistDetails:id/node()"/>);
>             Artist artist = Artist.getArtist(artistID);
>             String artist_name = artist.getArtistName();
>       </xsp:logic>
>       <artist-details>
>             <name><xsp:expr>artist_name</xsp:expr></name>
>       </artist-details>
> </xsl:template>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org