RE: Running fop from Java

2002-01-03 Thread "Buchtík, Michal"

You MUST use XSL-FO stylesheet to convert XML to PDF with FOP.

CSS stylesheet is used to display  XML in browser

Michal


-Original Message-
From: Mitchell, Scott(LIT) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 03, 2002 11:49 AM
To: [EMAIL PROTECTED]
Subject: RE: Running fop from Java


I do not have an xsl file.  I am using a .css file.  It does not do anything
at the minute, I am just trying to get it runnning initially.

> -Original Message-
> From: Claus Nielsen [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, January 03, 2002 10:58 AM
> To:   [EMAIL PROTECTED]
> Subject:      RE: Running fop from Java
> 
> 
> And your xsl ?
> 
> Claus Nielsen
> 
> 
> 
>  
> 
> "Mitchell,
> 
> Scott(LIT)"   To:
> [EMAIL PROTECTED]
>  
>         -IT.co.uk>Subject: RE: Running fop
> from Java
>  
> 
> 03-01-2002 11:42
> 
> Please respond to
> 
> fop-dev
> 
>  
> 
>  
> 
> 
> 
> 
> 
>  <>
> Any help is greatly appreciated, I have only been working on this
> technology
> for a few days now.
> 
> > -Original Message-----
> > From:   Claus Nielsen [SMTP:[EMAIL PROTECTED]]
> > Sent:   Thursday, January 03, 2002 10:45 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Running fop from Java
> >
> >
> > How does your XML file look ?
> >
> > Claus Nielsen
> >
> >
> >
> >
> >
> > "Mitchell,
> >
> > Scott(LIT)"   To:
> > [EMAIL PROTECTED]
> >  >
> > -IT.co.uk>Subject: Running fop
> > from Java
> >
> >
> > 03-01-2002 11:32
> >
> > Please respond to
> >
> > fop-dev
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Hi,
> >
> > I am trying to use jox to take a java bean and create an xml file.  With
> > this file, I use fop to convert to a pdf.  I get the following error
> when
> > running the code.
> >
> > Input XSL; Line 1; Column 1
> > XSL Error: Could not parse Input XML document!
> > XSL Error: SAX Exception
> > org.apache.xalan.xslt.XSLProcessorException: The markup in the document
> > preceding the root element must be well-formed.
> > at
> > org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1630)
> > at
> >
> org.apache.xalan.xslt.XSLTEngineImpl.getSourceTreeFromInput(XSLTEngineImpl
> > .j
> >
> > ava:852)
> > at
> > org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:552)
> > at com.wutka.jox.test.TestSer.main(TestSer.java:82)
> >
> > This is the code, the red line is where the error occurs.
> >
> > public class TestSer
> > {
> > public static void main(String[] args)
> > {
> > try
> > {
> > TestBean b = new TestBean();
> > b.setFoo(5);
> > b.setBar("This is the bar value");
> > b.setThingies(new String[] {
> > "Moe", "Larry", "Curly", "Shemp", "Curly Joe" });
> > TestSubbean sub = new TestSubbean();
> > sub.setName("Mark");
> > sub.setAge(35);
> > b.setSub(sub);
> >
> > FileOutputStream fileOut = new
> > FileOutputStream
> ("f:/ProgramFiles/jox/source/com/wutka/jox/test/bean.xml")
> > ;
> > JOXBeanOutputStream joxOut = new
> JOXBeanOutputStream(fileOut);
> >
> > joxOut.writeObject("MarkTest", b);
> >
> > joxOut.close();
> >
> > ByteArrayOutputStream baos = new ByteArrayOutputStream();
> > Reader stylesheet = null;
> >
> > // Get the XSLT processor
> > XSLTProcessor processor = XSLTProcessorFactory.getProcessor
> ();
> >
> > // Create the input source
> > Reader responseReader = new
> > StringReader("f:/ProgramFiles/jox/source/com/wutka/jox/test/bean.xml");
> >
> > XSLTInputSource responseSource = new
> > XSLTInputSource(re

RE: Running fop from Java

2002-01-03 Thread Mitchell, Scott(LIT)

I do not have an xsl file.  I am using a .css file.  It does not do anything
at the minute, I am just trying to get it runnning initially.

> -Original Message-
> From: Claus Nielsen [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, January 03, 2002 10:58 AM
> To:   [EMAIL PROTECTED]
> Subject:      RE: Running fop from Java
> 
> 
> And your xsl ?
> 
> Claus Nielsen
> 
> 
> 
>  
> 
> "Mitchell,
> 
> Scott(LIT)"   To:
> [EMAIL PROTECTED]
>  
>         -IT.co.uk>Subject: RE: Running fop
> from Java
>  
> 
> 03-01-2002 11:42
> 
> Please respond to
> 
> fop-dev
> 
>  
> 
>  
> 
> 
> 
> 
> 
>  <>
> Any help is greatly appreciated, I have only been working on this
> technology
> for a few days now.
> 
> > -Original Message-----
> > From:   Claus Nielsen [SMTP:[EMAIL PROTECTED]]
> > Sent:   Thursday, January 03, 2002 10:45 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Running fop from Java
> >
> >
> > How does your XML file look ?
> >
> > Claus Nielsen
> >
> >
> >
> >
> >
> > "Mitchell,
> >
> > Scott(LIT)"   To:
> > [EMAIL PROTECTED]
> >  >
> > -IT.co.uk>Subject: Running fop
> > from Java
> >
> >
> > 03-01-2002 11:32
> >
> > Please respond to
> >
> > fop-dev
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Hi,
> >
> > I am trying to use jox to take a java bean and create an xml file.  With
> > this file, I use fop to convert to a pdf.  I get the following error
> when
> > running the code.
> >
> > Input XSL; Line 1; Column 1
> > XSL Error: Could not parse Input XML document!
> > XSL Error: SAX Exception
> > org.apache.xalan.xslt.XSLProcessorException: The markup in the document
> > preceding the root element must be well-formed.
> > at
> > org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1630)
> > at
> >
> org.apache.xalan.xslt.XSLTEngineImpl.getSourceTreeFromInput(XSLTEngineImpl
> > .j
> >
> > ava:852)
> > at
> > org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:552)
> > at com.wutka.jox.test.TestSer.main(TestSer.java:82)
> >
> > This is the code, the red line is where the error occurs.
> >
> > public class TestSer
> > {
> > public static void main(String[] args)
> > {
> > try
> > {
> > TestBean b = new TestBean();
> > b.setFoo(5);
> > b.setBar("This is the bar value");
> > b.setThingies(new String[] {
> > "Moe", "Larry", "Curly", "Shemp", "Curly Joe" });
> > TestSubbean sub = new TestSubbean();
> > sub.setName("Mark");
> > sub.setAge(35);
> > b.setSub(sub);
> >
> > FileOutputStream fileOut = new
> > FileOutputStream
> ("f:/ProgramFiles/jox/source/com/wutka/jox/test/bean.xml")
> > ;
> > JOXBeanOutputStream joxOut = new
> JOXBeanOutputStream(fileOut);
> >
> > joxOut.writeObject("MarkTest", b);
> >
> > joxOut.close();
> >
> > ByteArrayOutputStream baos = new ByteArrayOutputStream();
> > Reader stylesheet = null;
> >
> > // Get the XSLT processor
> > XSLTProcessor processor = XSLTProcessorFactory.getProcessor
> ();
> >
> > // Create the input source
> > Reader responseReader = new
> > StringReader("f:/ProgramFiles/jox/source/com/wutka/jox/test/bean.xml");
> >
> > XSLTInputSource responseSource = new
> > XSLTInputSource(responseReader);
> >
> > // Get the stylesheet
> > String stylesheetPath = "";
> >
> > try {
> > stylesheet = new FileReader("c:/stylesheet.css");
> > }
> >  

RE: Running fop from Java

2002-01-03 Thread Claus Nielsen


And your xsl ?

Claus Nielsen



   
 
"Mitchell, 
 
Scott(LIT)"   To: [EMAIL PROTECTED]   
 
Subject: RE: Running fop from Java   
 
   
 
03-01-2002 11:42   
 
Please respond to  
 
fop-dev
 
   
 
   
 




 <>
Any help is greatly appreciated, I have only been working on this
technology
for a few days now.

> -Original Message-
> From:   Claus Nielsen [SMTP:[EMAIL PROTECTED]]
> Sent:   Thursday, January 03, 2002 10:45 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Running fop from Java
>
>
> How does your XML file look ?
>
> Claus Nielsen
>
>
>
>
>
> "Mitchell,
>
> Scott(LIT)"   To:
> [EMAIL PROTECTED]
>         
> -IT.co.uk>Subject: Running fop
> from Java
>
>
> 03-01-2002 11:32
>
> Please respond to
>
> fop-dev
>
>
>
>
>
>
>
>
>
> Hi,
>
> I am trying to use jox to take a java bean and create an xml file.  With
> this file, I use fop to convert to a pdf.  I get the following error when
> running the code.
>
> Input XSL; Line 1; Column 1
> XSL Error: Could not parse Input XML document!
> XSL Error: SAX Exception
> org.apache.xalan.xslt.XSLProcessorException: The markup in the document
> preceding the root element must be well-formed.
> at
> org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1630)
> at
>
org.apache.xalan.xslt.XSLTEngineImpl.getSourceTreeFromInput(XSLTEngineImpl
> .j
>
> ava:852)
> at
> org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:552)
> at com.wutka.jox.test.TestSer.main(TestSer.java:82)
>
> This is the code, the red line is where the error occurs.
>
> public class TestSer
> {
> public static void main(String[] args)
> {
> try
> {
> TestBean b = new TestBean();
> b.setFoo(5);
> b.setBar("This is the bar value");
> b.setThingies(new String[] {
> "Moe", "Larry", "Curly", "Shemp", "Curly Joe" });
> TestSubbean sub = new TestSubbean();
> sub.setName("Mark");
> sub.setAge(35);
> b.setSub(sub);
>
> FileOutputStream fileOut = new
> FileOutputStream
("f:/ProgramFiles/jox/source/com/wutka/jox/test/bean.xml")
> ;
> JOXBeanOutputStream joxOut = new
JOXBeanOutputStream(fileOut);
>
> joxOut.writeObject("MarkTest", b);
>
> joxOut.close();
>
> ByteArrayOutputStream baos = new ByteArrayOutputStream();
> Reader stylesheet = null;
>
> // Get the XSLT processor
> XSLTProcessor processor = XSLTProcessorFactory.getProcessor
();
>
> // Create the input source
> Reader responseReader = new
> StringReader("f:/ProgramFiles/jox/source/com/wutka/jox/test/bean.xml");
>
> XSLTInputSource responseSource = new
> XSLTInputSource(responseReader);
>
> // Get the stylesheet
> String stylesheetPath = "";
>
> try {
> stylesheet = new FileReader("c:/stylesheet.css");
> }
> catch (FileNotFoundException fnfe) {}
>
> if (stylesheet == null) {
> stylesheet = new FileReader("c:/stylesheet.css");
> }
>
> XSLTInputSource stylesheetSource = new
> XSLTInputSource(stylesheet);
>
> // 

RE: Running fop from Java

2002-01-03 Thread Mitchell, Scott(LIT)




35
Mark

This is the bar value
Jan 2, 2002
Moe
Larry
Curly
Shemp
Curly Joe
5


> -Original Message-
> From: Claus Nielsen [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, January 03, 2002 10:45 AM
> To:   [EMAIL PROTECTED]
> Subject:      Re: Running fop from Java
> 
> 
> How does your XML file look ?
> 
> Claus Nielsen
> 
> 
> 
>  
> 
> "Mitchell,
> 
> Scott(LIT)"   To:
> [EMAIL PROTECTED]
>      
>     -IT.co.uk>Subject: Running fop
> from Java
>  
> 
> 03-01-2002 11:32
> 
> Please respond to
> 
> fop-dev
> 
>  
> 
>  
> 
> 
> 
> 
> 
> Hi,
> 
> I am trying to use jox to take a java bean and create an xml file.  With
> this file, I use fop to convert to a pdf.  I get the following error when
> running the code.
> 
> Input XSL; Line 1; Column 1
> XSL Error: Could not parse Input XML document!
> XSL Error: SAX Exception
> org.apache.xalan.xslt.XSLProcessorException: The markup in the document
> preceding the root element must be well-formed.
> at
> org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1630)
> at
> org.apache.xalan.xslt.XSLTEngineImpl.getSourceTreeFromInput(XSLTEngineImpl
> .j
> 
> ava:852)
> at
> org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:552)
> at com.wutka.jox.test.TestSer.main(TestSer.java:82)
> 
> This is the code, the red line is where the error occurs.
> 
> public class TestSer
> {
> public static void main(String[] args)
> {
> try
> {
> TestBean b = new TestBean();
> b.setFoo(5);
> b.setBar("This is the bar value");
> b.setThingies(new String[] {
> "Moe", "Larry", "Curly", "Shemp", "Curly Joe" });
> TestSubbean sub = new TestSubbean();
> sub.setName("Mark");
> sub.setAge(35);
> b.setSub(sub);
> 
> FileOutputStream fileOut = new
> FileOutputStream("f:/ProgramFiles/jox/source/com/wutka/jox/test/bean.xml")
> ;
> JOXBeanOutputStream joxOut = new JOXBeanOutputStream(fileOut);
> 
> joxOut.writeObject("MarkTest", b);
> 
> joxOut.close();
> 
> ByteArrayOutputStream baos = new ByteArrayOutputStream();
> Reader stylesheet = null;
> 
> // Get the XSLT processor
> XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
> 
> // Create the input source
> Reader responseReader = new
> StringReader("f:/ProgramFiles/jox/source/com/wutka/jox/test/bean.xml");
> 
> XSLTInputSource responseSource = new
> XSLTInputSource(responseReader);
> 
> // Get the stylesheet
> String stylesheetPath = "";
> 
> try {
> stylesheet = new FileReader("c:/stylesheet.css");
> }
> catch (FileNotFoundException fnfe) {}
> 
> if (stylesheet == null) {
> stylesheet = new FileReader("c:/stylesheet.css");
> }
> 
> XSLTInputSource stylesheetSource = new
> XSLTInputSource(stylesheet);
> 
> // Get a target to contain the output
> Writer formWriter  = new StringWriter();
> XSLTResultTarget target = new XSLTResultTarget(formWriter);
> 
> // Transform the XML response to fo format
> processor.process(responseSource, stylesheetSource, target);
> 
> // Redirect the fo file from a Writer to a Reader
> Reader formReader = new StringReader(formWriter.toString());
> 
> // Transform from fop to pdf
> XMLReader xmlReader = new SAXParser();
> Driver driver = new Driver();
> driver.setRenderer(new org.apache.fop.render.pdf.PDFRenderer
> ());
> 
> driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
> 
> driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
> 
> driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
> 
> driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
> driver.setOutputStream(new BufferedOutputStream(baos));
> 

RE: Running fop from Java

2002-01-03 Thread Mitchell, Scott(LIT)

 <> 
Any help is greatly appreciated, I have only been working on this technology
for a few days now.

> -Original Message-
> From: Claus Nielsen [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, January 03, 2002 10:45 AM
> To:   [EMAIL PROTECTED]
> Subject:  Re: Running fop from Java
> 
> 
> How does your XML file look ?
> 
> Claus Nielsen
> 
> 
> 
>  
> 
> "Mitchell,
> 
> Scott(LIT)"   To:
> [EMAIL PROTECTED]
>          
> -IT.co.uk>Subject: Running fop
> from Java
>  
> 
> 03-01-2002 11:32
> 
> Please respond to
> 
> fop-dev
> 
>  
> 
>  
> 
> 
> 
> 
> 
> Hi,
> 
> I am trying to use jox to take a java bean and create an xml file.  With
> this file, I use fop to convert to a pdf.  I get the following error when
> running the code.
> 
> Input XSL; Line 1; Column 1
> XSL Error: Could not parse Input XML document!
> XSL Error: SAX Exception
> org.apache.xalan.xslt.XSLProcessorException: The markup in the document
> preceding the root element must be well-formed.
> at
> org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1630)
> at
> org.apache.xalan.xslt.XSLTEngineImpl.getSourceTreeFromInput(XSLTEngineImpl
> .j
> 
> ava:852)
> at
> org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:552)
> at com.wutka.jox.test.TestSer.main(TestSer.java:82)
> 
> This is the code, the red line is where the error occurs.
> 
> public class TestSer
> {
> public static void main(String[] args)
> {
> try
> {
> TestBean b = new TestBean();
> b.setFoo(5);
> b.setBar("This is the bar value");
> b.setThingies(new String[] {
> "Moe", "Larry", "Curly", "Shemp", "Curly Joe" });
> TestSubbean sub = new TestSubbean();
> sub.setName("Mark");
> sub.setAge(35);
> b.setSub(sub);
> 
> FileOutputStream fileOut = new
> FileOutputStream("f:/ProgramFiles/jox/source/com/wutka/jox/test/bean.xml")
> ;
> JOXBeanOutputStream joxOut = new JOXBeanOutputStream(fileOut);
> 
> joxOut.writeObject("MarkTest", b);
> 
> joxOut.close();
> 
> ByteArrayOutputStream baos = new ByteArrayOutputStream();
> Reader stylesheet = null;
> 
> // Get the XSLT processor
> XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
> 
> // Create the input source
> Reader responseReader = new
> StringReader("f:/ProgramFiles/jox/source/com/wutka/jox/test/bean.xml");
> 
> XSLTInputSource responseSource = new
> XSLTInputSource(responseReader);
> 
> // Get the stylesheet
> String stylesheetPath = "";
> 
> try {
> stylesheet = new FileReader("c:/stylesheet.css");
> }
> catch (FileNotFoundException fnfe) {}
> 
> if (stylesheet == null) {
> stylesheet = new FileReader("c:/stylesheet.css");
> }
> 
> XSLTInputSource stylesheetSource = new
> XSLTInputSource(stylesheet);
> 
> // Get a target to contain the output
> Writer formWriter  = new StringWriter();
> XSLTResultTarget target = new XSLTResultTarget(formWriter);
> 
> // Transform the XML response to fo format
> processor.process(responseSource, stylesheetSource, target);
> 
> // Redirect the fo file from a Writer to a Reader
> Reader formReader = new StringReader(formWriter.toString());
> 
> // Transform from fop to pdf
> XMLReader xmlReader = new SAXParser();
> Driver driver = new Driver();
> driver.setRenderer(new org.apache.fop.render.pdf.PDFRenderer
> ());
> 
> driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
> 
> driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
> 
> driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
> 
> driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
> driver.setOutputStream(new BufferedOutputS

Re: Running fop from Java

2002-01-03 Thread Claus Nielsen


How does your XML file look ?

Claus Nielsen



   
 
"Mitchell, 
 
Scott(LIT)"   To: [EMAIL PROTECTED]   
 
Subject:     Running fop from Java   
 
   
 
03-01-2002 11:32   
 
Please respond to  
 
fop-dev
 
   
 
   
 




Hi,

I am trying to use jox to take a java bean and create an xml file.  With
this file, I use fop to convert to a pdf.  I get the following error when
running the code.

Input XSL; Line 1; Column 1
XSL Error: Could not parse Input XML document!
XSL Error: SAX Exception
org.apache.xalan.xslt.XSLProcessorException: The markup in the document
preceding the root element must be well-formed.
at
org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1630)
at
org.apache.xalan.xslt.XSLTEngineImpl.getSourceTreeFromInput(XSLTEngineImpl.j

ava:852)
at
org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:552)
at com.wutka.jox.test.TestSer.main(TestSer.java:82)

This is the code, the red line is where the error occurs.

public class TestSer
{
public static void main(String[] args)
{
try
{
TestBean b = new TestBean();
b.setFoo(5);
b.setBar("This is the bar value");
b.setThingies(new String[] {
"Moe", "Larry", "Curly", "Shemp", "Curly Joe" });
TestSubbean sub = new TestSubbean();
sub.setName("Mark");
sub.setAge(35);
b.setSub(sub);

FileOutputStream fileOut = new
FileOutputStream("f:/ProgramFiles/jox/source/com/wutka/jox/test/bean.xml");
JOXBeanOutputStream joxOut = new JOXBeanOutputStream(fileOut);

joxOut.writeObject("MarkTest", b);

joxOut.close();

ByteArrayOutputStream baos = new ByteArrayOutputStream();
Reader stylesheet = null;

// Get the XSLT processor
XSLTProcessor processor = XSLTProcessorFactory.getProcessor();

// Create the input source
Reader responseReader = new
StringReader("f:/ProgramFiles/jox/source/com/wutka/jox/test/bean.xml");

XSLTInputSource responseSource = new
XSLTInputSource(responseReader);

// Get the stylesheet
String stylesheetPath = "";

try {
stylesheet = new FileReader("c:/stylesheet.css");
}
catch (FileNotFoundException fnfe) {}

if (stylesheet == null) {
stylesheet = new FileReader("c:/stylesheet.css");
}

XSLTInputSource stylesheetSource = new
XSLTInputSource(stylesheet);

// Get a target to contain the output
Writer formWriter  = new StringWriter();
XSLTResultTarget target = new XSLTResultTarget(formWriter);

// Transform the XML response to fo format
processor.process(responseSource, stylesheetSource, target);

// Redirect the fo file from a Writer to a Reader
Reader formReader = new StringReader(formWriter.toString());

// Transform from fop to pdf
XMLReader xmlReader = new SAXParser();
Driver driver = new Driver();
driver.setRenderer(new org.apache.fop.render.pdf.PDFRenderer
());

driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");

driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");

driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");

driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
driver.setOutputStream(new BufferedOutputStream(baos));
driver.buildFOTree(xmlReader, new InputSource(formReader));
driver.format();
driver.render();

// Clean up
baos

Running fop from Java

2002-01-03 Thread Mitchell, Scott(LIT)

Hi,

I am trying to use jox to take a java bean and create an xml file.  With
this file, I use fop to convert to a pdf.  I get the following error when
running the code.  

Input XSL; Line 1; Column 1
XSL Error: Could not parse Input XML document!
XSL Error: SAX Exception
org.apache.xalan.xslt.XSLProcessorException: The markup in the document
preceding the root element must be well-formed.
at
org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1630)
at
org.apache.xalan.xslt.XSLTEngineImpl.getSourceTreeFromInput(XSLTEngineImpl.j
ava:852)
at
org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:552)
at com.wutka.jox.test.TestSer.main(TestSer.java:82)

This is the code, the red line is where the error occurs.

public class TestSer
{
public static void main(String[] args)
{
try
{
TestBean b = new TestBean();
b.setFoo(5);
b.setBar("This is the bar value");
b.setThingies(new String[] {
"Moe", "Larry", "Curly", "Shemp", "Curly Joe" });
TestSubbean sub = new TestSubbean();
sub.setName("Mark");
sub.setAge(35);
b.setSub(sub);

FileOutputStream fileOut = new
FileOutputStream("f:/ProgramFiles/jox/source/com/wutka/jox/test/bean.xml");
JOXBeanOutputStream joxOut = new JOXBeanOutputStream(fileOut);

joxOut.writeObject("MarkTest", b);

joxOut.close(); 
   
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Reader stylesheet = null;

// Get the XSLT processor
XSLTProcessor processor = XSLTProcessorFactory.getProcessor();

// Create the input source
Reader responseReader = new
StringReader("f:/ProgramFiles/jox/source/com/wutka/jox/test/bean.xml");
  
XSLTInputSource responseSource = new
XSLTInputSource(responseReader);

// Get the stylesheet
String stylesheetPath = "";

try {
stylesheet = new FileReader("c:/stylesheet.css");
} 
catch (FileNotFoundException fnfe) {}

if (stylesheet == null) {
stylesheet = new FileReader("c:/stylesheet.css");
}

XSLTInputSource stylesheetSource = new
XSLTInputSource(stylesheet);

// Get a target to contain the output
Writer formWriter  = new StringWriter();
XSLTResultTarget target = new XSLTResultTarget(formWriter);

// Transform the XML response to fo format
processor.process(responseSource, stylesheetSource, target);

// Redirect the fo file from a Writer to a Reader
Reader formReader = new StringReader(formWriter.toString());

// Transform from fop to pdf
XMLReader xmlReader = new SAXParser();  
Driver driver = new Driver();
driver.setRenderer(new org.apache.fop.render.pdf.PDFRenderer());
 
driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
 
driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
 
driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
 
driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
driver.setOutputStream(new BufferedOutputStream(baos));
driver.buildFOTree(xmlReader, new InputSource(formReader));
driver.format();
driver.render();

// Clean up
baos.close();
stylesheet.close();
}
catch (Exception exc)
{
exc.printStackTrace();
}
}
}


Any ideas would be appreciated.

Scott Mitchell
Experienced Software Developer

Liberty Information Technology  Direct Line: ++44 (0) 28 9044 5582
Clarendon House   Fax:   ++44 (0) 28 9044 5511
9-21 Adelaide StreetSwitchboard:   ++44 (0) 28 9044 5500
Belfast, Northern Ireland BT2 8DJ  Email:
[EMAIL PROTECTED]

Disclaimer: The contents of this e-mail and attached files in no way reflect
any policies of Liberty Information Technology Ltd.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Running Fop from JAVA program

2001-06-05 Thread Olivieri, Steven

Hi all,

this may be a rookie questionhope you can help.

I can run Fop (0.18.0) perfectly from the command line.   I created a style
sheet (xsl file), which converts the xml file.  On the command line, I input
the xsl file, the xml file, and state the name for the pdf file.

Now I'm trying to run Fop from within method in my JAVA program.   This
doesn't seem to work.  Here's the code.   Can someone tell me what I'm doing
wrong?   Is it okay to run Fop this way?   My classpath is set up properly
(it runs on the command line).

Here's the code..Thanks in advance for any help.


String [] pdfParams = new String[6];
pdfParams[0] = "-xsl";
pdfParams[1] = xslFile;
pdfParams[2] = "-xml";
pdfParams[3] = xmlFile;
pdfParams[4] = "-pdf";
pdfParams[5] = pdfFile;

org.apache.fop.apps.Fop.main(pdfParams);


Regards,
Steve Olivieri
[EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]