You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Eldho George <ge...@ocwen.co.in> on 2004/09/17 14:10:28 UTC

problem with XSLTInputHandler(String,String) constructor

Hi all,
I have problem with XsltInputHandler. I tried with the following code.But
its not working.I worked with XsltInputHandler (file,file)constructor. It
worked fine.Please tell me what is the problem.I want to pass xml and xsl as
string.Please help me.Thanks in advance
 
                                    
                        xsl is a string contains my xsl file
                        xml is a string contains my xml file
 
InputSource is1=new InputSource(xsl);                                   
            InputSource is2=new InputSource(xml);
            
            XSLTInputHandler inputHandler = new XSLTInputHandler(is1,is2);
            //XSLTInputHandler inputHandler = new XSLTInputHandler(xml,xsl);
            ByteArrayOutputStream outStream = new ByteArrayOutputStream(); 
            
            driver.setOutputStream(outStream);
            
            driver.render(inputHandler.getParser(),
inputHandler.getInputSource()); 
            
            byte[] content = outStream.toByteArray();
            res.setContentLength(content.length);
            
            res.setContentType("application/pdf");
          
           res.getOutputStream().write(content);
           res.getOutputStream().flush();
           
           outStream.close();
 
 
//I ALSO TRIED WITH XSLTInputHandler inputHandler = new
XSLTInputHandler(xml,xsl); 
// means XSLTInputHandler(String,String) constructor
 
 
 


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


Re: problem with XSLTInputHandler(String,String) constructor

Posted by Jebus <lo...@gmail.com>.
for the  constructors that take strings, the strings are not the
contents of the the file but a systemid (url to a file ).  If you have
your xml and xsl in strings your can use a StringReader or a
ByteArrayInputStream

InputSource( new ByteArrayInputStream( xml.getBytes() ) );


----- Original Message -----
From: Eldho George <ge...@ocwen.co.in>
Date: Fri, 17 Sep 2004 17:40:28 +0530
Subject: problem with XSLTInputHandler(String,String) constructor
To: "fop-user@xml.apache.org" <fo...@xml.apache.org>

 
 

Hi all, 

I have problem with XsltInputHandler. I tried with the following
code.But its not working.I worked with XsltInputHandler
(file,file)constructor. It worked fine.Please tell me what is the
problem.I want to pass xml and xsl as string.Please help me.Thanks in
advance

  

                                    

                        xsl is a string contains my xsl file 

                        xml is a string contains my xml file 

  

InputSource is1=new InputSource(xsl);                                   

            InputSource is2=new InputSource(xml); 

            

            XSLTInputHandler inputHandler = new XSLTInputHandler(is1,is2); 

            //XSLTInputHandler inputHandler = new XSLTInputHandler(xml,xsl); 

            ByteArrayOutputStream outStream = new ByteArrayOutputStream(); 

            

            driver.setOutputStream(outStream); 

            

            driver.render(inputHandler.getParser(),
inputHandler.getInputSource());

            

            byte[] content = outStream.toByteArray(); 

            res.setContentLength(content.length); 

            

            res.setContentType("application/pdf"); 

          

           res.getOutputStream().write(content); 

           res.getOutputStream().flush(); 

           

           outStream.close(); 

  

  

//I ALSO TRIED WITH XSLTInputHandler inputHandler = new
XSLTInputHandler(xml,xsl);

// means XSLTInputHandler(String,String) constructor 

  

  

  
 
 **********************************************************************
 This email and any files transmitted with it are confidential and
 intended solely for the use of the individual or entity to whom they
 are addressed. If you have received this email in error please notify
 the system manager.
 
 This footnote also confirms that this email message has been swept by
 MIMEsweeper for the presence of computer viruses.
 
 www.mimesweeper.com
 **********************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org