You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Thomas Muschalik <th...@aquin.de> on 2001/02/05 11:33:03 UTC
Q: FO2PDFFormatter() class
Dear Cocoon-Users,
Ive got a problem with the FO2PDFFormatter() class.
The use of the arguments of the .format(org.w3c.dom.Document document,
java.io.Writer writer, java.util.Dictionary parameters
) Method isnt really clear.
I dont know how to handle the Dictionary and i hope my suppose the writer
means "FileWriter m_fw = new FileWriter("dark.pdf");" is right.
Thanks a lot.
Here a snippet:
public class VposMain {
public VposMain() {
}
public static void main(String[] args) {
VposMain vposMain1 = new VposMain();
try{
Configurations m_conf = new Configurations("cocoon.properties");
File m_file = new File("darkness-novel.xml");
FileWriter m_fw = new FileWriter("dark.pdf");
FO2PDFFormatter m_form = new FO2PDFFormatter();
m_form.init(m_conf);
m_form.format(readFile(m_file), m_fw, Di);
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static Document readFile(File file) throws Exception
{
Document doc;
try
{
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(true);
DocumentBuilder db = dbf.newDocumentBuilder();
doc=db.parse(file);
return doc;
}
catch(SAXParseException ex)
{
throw (ex);
}
catch(SAXException ex)
{
Exception x = ex.getException();
throw((x == null) ? ex: x);
}
}
Thomas Muschalik
AQUIN AG
Eschenheimer Anlage 1
60316 Frankfurt am Main
Telefon: 0 69 / 94 34 08 - 705
Telefax: 0 69 / 94 34 08 - 750
E-Mail: tm@aquin.de
[C1.8.2] ESQL question
Posted by Drasko Kokic <dr...@yahoo.com>.
Hi there,
I am having a problem in XSLT layer and am trying to
find what could possibly cause the error.
I am trying to process an array (created by ESQL)
which looks like this (including all white spaces):
<TOTAL TIMESTAMP="2001-01-29 00:00">
2
</TOTAL><TOTAL
TIMESTAMP="2001-01-27 00:00">
16
</TOTAL><TOTAL
TIMESTAMP="2001-01-26 00:00">
672
</TOTAL><TOTAL
TIMESTAMP="2001-01-25 00:00">
576
</TOTAL>
I would like to know how to get rid of <new-line>
<25-space-chars> <new-line> <25-space-chars> before
each value and <new-line> <25-space-chars> after each
value ?!
Here is the ESQL code segment (without 18 space chars
at the begining):
<esql:row-results>
<TOTAL>
<xsp:attribute name="TIMESTAMP"><esql:get-string
column="PERIOD"/></xsp:attribute>
<esql:get-int column="TOTAL"/>
</TOTAL>
</esql:row-results>
One way to resolve the "problem" is to write the whole
<TOTAL> ... </TOTAL> in one line without any spaces
and new lines ... but, that doesn't look nice.
MY QUESTION: Is there any way to strip all the white
spaces before the code is generated so that I get only
the results values without any formating white spaces?
MORE PRECISE QUESTION: Is it possible in XSP (and/or
ESQL taglib) to ignore any text not included in an
XSP/ESQL nodes? That way the above mentioned ESQL
block would generate something like:
<TOTAL TIMESTAMP="2001-01-29 00:00">2</TOTAL>
<TOTAL TIMESTAMP="2001-01-27 00:00">16</TOTAL>
<TOTAL TIMESTAMP="2001-01-26 00:00">672</TOTAL>
<TOTAL TIMESTAMP="2001-01-25 00:00">576</TOTAL>
Is this behaviour under the power of XSP/ESQL or more
in the area of the XML serialiser???
Thanks in advance
Drasko
__________________________________________________
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/