Package net.sf.jasperreports.engine.xml
Class JRXmlLoader
- java.lang.Object
-
- net.sf.jasperreports.engine.xml.JRXmlLoader
-
public class JRXmlLoader extends Object
Utility class that helps parsing a JRXML file into aJasperDesignobject.This can be done using one of the
load(...)orloadXmlmethods published by this class. Applications might need to do this in cases where report templates kept in their source form (JRXML) must be modified at runtime based on some user input and then compiled on the fly for filling with data.- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description static StringEXCEPTION_MESSAGE_KEY_SUBDATASET_NOT_FOUNDstatic StringEXCEPTION_MESSAGE_KEY_UNKNOWN_SUBDATASET
-
Constructor Summary
Constructors Constructor Description JRXmlLoader(JasperReportsContext jasperReportsContext, org.apache.commons.digester.Digester digester)
-
Method Summary
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_UNKNOWN_SUBDATASET
public static final String EXCEPTION_MESSAGE_KEY_UNKNOWN_SUBDATASET
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_SUBDATASET_NOT_FOUND
public static final String EXCEPTION_MESSAGE_KEY_SUBDATASET_NOT_FOUND
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JRXmlLoader
public JRXmlLoader(JasperReportsContext jasperReportsContext, org.apache.commons.digester.Digester digester)
-
-
Method Detail
-
getJasperReportsContext
public JasperReportsContext getJasperReportsContext()
-
setJasperDesign
public void setJasperDesign(JasperDesign jasperDesign)
-
addGroupReference
public void addGroupReference(XmlGroupReference reference)
-
addGroupReprintedElement
public void addGroupReprintedElement(JRDesignElement element)
Deprecated.To be removed.
-
addGroupEvaluatedImage
public void addGroupEvaluatedImage(JRDesignImage image)
Deprecated.To be removed.
-
addGroupEvaluatedTextField
public void addGroupEvaluatedTextField(JRDesignTextField textField)
Deprecated.To be removed.
-
addGroupEvaluatedChart
public void addGroupEvaluatedChart(JRDesignChart chart)
Deprecated.To be removed.
-
getGroupBoundDatasets
public Set<JRElementDataset> getGroupBoundDatasets()
-
load
public static JasperDesign load(String sourceFileName) throws JRException
- Throws:
JRException- See Also:
load(JasperReportsContext, String)
-
load
public static JasperDesign load(JasperReportsContext jasperReportsContext, String sourceFileName) throws JRException
- Throws:
JRException
-
load
public static JasperDesign load(File file) throws JRException
- Throws:
JRException- See Also:
load(JasperReportsContext, File)
-
load
public static JasperDesign load(JasperReportsContext jasperReportsContext, File file) throws JRException
- Throws:
JRException
-
load
public static JasperDesign load(InputStream is) throws JRException
- Throws:
JRException- See Also:
load(JasperReportsContext, InputStream)
-
load
public static JasperDesign load(JasperReportsContext jasperReportsContext, InputStream is) throws JRException
- Throws:
JRException
-
loadXML
public JasperDesign loadXML(InputStream is) throws JRException
- Throws:
JRException
-
loadXML
public JasperDesign loadXML(InputSource is) throws JRException
- Throws:
JRException
-
resolveGroup
protected JRGroup resolveGroup(String groupName, XmlLoaderReportContext context)
-
addError
public void addError(Exception e)
-
isIgnoreConsistencyProblems
public boolean isIgnoreConsistencyProblems()
Returns true if the loader is set to ignore consistency problems- Returns:
- the ignoreConsistencyProblems flag.
-
setIgnoreConsistencyProblems
public void setIgnoreConsistencyProblems(boolean ignoreConsistencyProblems)
Allows to enable or disable the reporting of consistency problems. Consistency problems are problems in the logical structure of the report such as references to missing groups and fonts.- Parameters:
ignoreConsistencyProblems- The ignoreConsistencyProblems value to set.
-
pushReportContext
public void pushReportContext(XmlLoaderReportContext context)
-
popReportContext
public XmlLoaderReportContext popReportContext()
-
getReportContext
public XmlLoaderReportContext getReportContext()
-
-