Package net.sf.jasperreports.engine.xml
Class JRXmlTemplateWriter
- java.lang.Object
-
- net.sf.jasperreports.engine.xml.JRXmlBaseWriter
-
- net.sf.jasperreports.engine.xml.JRXmlTemplateWriter
-
public class JRXmlTemplateWriter extends JRXmlBaseWriter
Template
XML serializer.- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
- See Also:
JRXmlTemplateLoader
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_ENCODING
Default XML output encoding.static XmlNamespace
JASPERTEMPLATE_NAMESPACE
-
Fields inherited from class net.sf.jasperreports.engine.xml.JRXmlBaseWriter
PROPERTY_REPORT_VERSION, version, versionComparator, writer
-
-
Constructor Summary
Constructors Constructor Description JRXmlTemplateWriter(JasperReportsContext jasperReportsContext, JRTemplate template, java.io.Writer out, java.lang.String encoding)
Creates an XML template writer.JRXmlTemplateWriter(JRTemplate template, java.io.Writer out, java.lang.String encoding)
Creates an XML template writer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
toWriteConditionalStyles()
Decides whether conditional styles are to be written.void
write()
Writes the template to the output writer.protected void
writeIncludedTemplate(JRTemplateReference reference)
protected void
writeIncludedTemplates()
protected void
writeStyles()
static java.lang.String
writeTemplate(JasperReportsContext jasperReportsContext, JRTemplate template)
Returns the XML representation of a template.static void
writeTemplate(JasperReportsContext jasperReportsContext, JRTemplate template, java.io.OutputStream out)
Writes the XML representation of a template to an output stream.static void
writeTemplate(JasperReportsContext jasperReportsContext, JRTemplate template, java.io.OutputStream out, java.lang.String encoding)
Writes the XML representation of a template to an output stream.protected static void
writeTemplate(JasperReportsContext jasperReportsContext, JRTemplate template, java.io.Writer out, java.lang.String encoding)
static java.lang.String
writeTemplate(JasperReportsContext jasperReportsContext, JRTemplate template, java.lang.String encoding)
Returns the XML representation of a template.static java.lang.String
writeTemplate(JRTemplate template)
Returns the XML representation of a template.static void
writeTemplate(JRTemplate template, java.io.OutputStream out)
Writes the XML representation of a template to an output stream.static void
writeTemplate(JRTemplate template, java.io.OutputStream out, java.lang.String encoding)
Writes the XML representation of a template to an output stream.static java.lang.String
writeTemplate(JRTemplate template, java.lang.String encoding)
Returns the XML representation of a template.static void
writeTemplateToFile(JasperReportsContext jasperReportsContext, JRTemplate template, java.lang.String outputFile)
Writes the XML representation of a template to a file.static void
writeTemplateToFile(JasperReportsContext jasperReportsContext, JRTemplate template, java.lang.String outputFile, java.lang.String encoding)
Writes the XML representation of a template to a file.static void
writeTemplateToFile(JRTemplate template, java.lang.String outputFile)
Writes the XML representation of a template to a file.static void
writeTemplateToFile(JRTemplate template, java.lang.String outputFile, java.lang.String encoding)
Writes the XML representation of a template to a file.-
Methods inherited from class net.sf.jasperreports.engine.xml.JRXmlBaseWriter
isNewerVersionOrEqual, isOlderVersionThan, useWriter, writeBox, writeBox, writeConditionalStyle, writeExpression, writeParagraph, writeParagraph, writePen, writeStyle, writeStyleReferenceAttr, writeTabStop
-
-
-
-
Field Detail
-
JASPERTEMPLATE_NAMESPACE
public static final XmlNamespace JASPERTEMPLATE_NAMESPACE
-
DEFAULT_ENCODING
public static final java.lang.String DEFAULT_ENCODING
Default XML output encoding.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JRXmlTemplateWriter
public JRXmlTemplateWriter(JRTemplate template, java.io.Writer out, java.lang.String encoding)
Creates an XML template writer.- Parameters:
template
- the template to writeout
- the output writerencoding
- the XML encoding to use
-
JRXmlTemplateWriter
public JRXmlTemplateWriter(JasperReportsContext jasperReportsContext, JRTemplate template, java.io.Writer out, java.lang.String encoding)
Creates an XML template writer.- Parameters:
jasperReportsContext
-template
- the template to writeout
- the output writerencoding
- the XML encoding to use
-
-
Method Detail
-
writeTemplate
public static java.lang.String writeTemplate(JRTemplate template)
Returns the XML representation of a template. Usesthe default encoding
.- Parameters:
template
- the template- Returns:
- the XML representation of the template
-
writeTemplate
public static java.lang.String writeTemplate(JasperReportsContext jasperReportsContext, JRTemplate template)
Returns the XML representation of a template. Usesthe default encoding
.- Parameters:
jasperReportsContext
-template
- the template- Returns:
- the XML representation of the template
-
writeTemplate
public static java.lang.String writeTemplate(JRTemplate template, java.lang.String encoding)
Returns the XML representation of a template.- Parameters:
template
- the templateencoding
- the XML encoding to use- Returns:
- the XML representation of the template
-
writeTemplate
public static java.lang.String writeTemplate(JasperReportsContext jasperReportsContext, JRTemplate template, java.lang.String encoding)
Returns the XML representation of a template.- Parameters:
jasperReportsContext
-template
- the templateencoding
- the XML encoding to use- Returns:
- the XML representation of the template
-
writeTemplate
public static void writeTemplate(JRTemplate template, java.io.OutputStream out)
Writes the XML representation of a template to an output stream. Usesthe default encoding
.- Parameters:
template
- the templateout
- the output stream
-
writeTemplate
public static void writeTemplate(JasperReportsContext jasperReportsContext, JRTemplate template, java.io.OutputStream out)
Writes the XML representation of a template to an output stream. Usesthe default encoding
.- Parameters:
jasperReportsContext
-template
- the templateout
- the output stream
-
writeTemplate
public static void writeTemplate(JRTemplate template, java.io.OutputStream out, java.lang.String encoding)
Writes the XML representation of a template to an output stream.- Parameters:
template
- the templateout
- the output streamencoding
- the XML encoding to use
-
writeTemplate
public static void writeTemplate(JasperReportsContext jasperReportsContext, JRTemplate template, java.io.OutputStream out, java.lang.String encoding)
Writes the XML representation of a template to an output stream.- Parameters:
jasperReportsContext
-template
- the templateout
- the output streamencoding
- the XML encoding to use
-
writeTemplateToFile
public static void writeTemplateToFile(JRTemplate template, java.lang.String outputFile)
Writes the XML representation of a template to a file. Usesthe default encoding
.- Parameters:
template
- the templateoutputFile
- the output file name
-
writeTemplateToFile
public static void writeTemplateToFile(JasperReportsContext jasperReportsContext, JRTemplate template, java.lang.String outputFile)
Writes the XML representation of a template to a file. Usesthe default encoding
.- Parameters:
jasperReportsContext
-template
- the templateoutputFile
- the output file name
-
writeTemplateToFile
public static void writeTemplateToFile(JRTemplate template, java.lang.String outputFile, java.lang.String encoding)
Writes the XML representation of a template to a file.- Parameters:
template
- the templateoutputFile
- the output file nameencoding
- the XML encoding to use
-
writeTemplateToFile
public static void writeTemplateToFile(JasperReportsContext jasperReportsContext, JRTemplate template, java.lang.String outputFile, java.lang.String encoding)
Writes the XML representation of a template to a file.- Parameters:
jasperReportsContext
-template
- the templateoutputFile
- the output file nameencoding
- the XML encoding to use
-
writeTemplate
protected static void writeTemplate(JasperReportsContext jasperReportsContext, JRTemplate template, java.io.Writer out, java.lang.String encoding) throws java.io.IOException
- Throws:
java.io.IOException
-
write
public void write() throws java.io.IOException
Writes the template to the output writer.- Throws:
java.io.IOException
-
writeIncludedTemplates
protected void writeIncludedTemplates() throws java.io.IOException
- Throws:
java.io.IOException
-
writeIncludedTemplate
protected void writeIncludedTemplate(JRTemplateReference reference) throws java.io.IOException
- Throws:
java.io.IOException
-
writeStyles
protected void writeStyles() throws java.io.IOException
- Throws:
java.io.IOException
-
toWriteConditionalStyles
protected boolean toWriteConditionalStyles()
Description copied from class:JRXmlBaseWriter
Decides whether conditional styles are to be written.- Specified by:
toWriteConditionalStyles
in classJRXmlBaseWriter
- Returns:
- whether conditional styles are to be written
-
-