List of usage examples for org.dom4j.dom DOMDocumentFactory getInstance
public static DocumentFactory getInstance()
Access to the singleton instance of this factory.
From source file:com.amalto.workbench.widgets.xmleditor.pagecontent.ExtensibleXMLEditorPageContent.java
License:Open Source License
public String toXMLExpression() { Document xmlDoc = DOMDocumentFactory.getInstance().createDocument(); fillXMLDoc(xmlDoc);// www. j a va 2 s .co m try { return XmlUtil.formatPretty(XmlUtil.toXml(xmlDoc), "UTF-8");//$NON-NLS-1$ } catch (DocumentException e) { return "";//$NON-NLS-1$ } }
From source file:com.flaptor.hounder.util.HtmlParser.java
License:Apache License
/** * This parser deletes all the tags and returns only the text. However some * tags are used to separate dofferent phrases, so we just add a '.' after * some tags to make sure we will be able to distinguish one phrase from * the other in the text/*ww w . j a v a2 s .c o m*/ * @param htmlDoc */ @SuppressWarnings("unchecked") private void replaceSeparatorTags(Document htmlDoc) { for (String tag : SEPARATOR_TAGS) { List<Element> nodes = (List<Element>) htmlDoc.selectNodes("//" + tag.toUpperCase()); for (Element node : nodes) { try { // The 'separator' must be created each time inside the for, // else there is a 'already have a parent' conflict Node separator = DOMDocumentFactory.getInstance().createText(SEPARATOR); node.add(separator); } catch (Exception e) { logger.warn("Ignoring exception, not appending at " + node.getPath()); continue; } } } }
From source file:com.flaptor.util.parser.HtmlParser.java
License:Apache License
/** * This parser deletes all the tags and returns only the text. However some * tags are used to separate dofferent phrases, so we just add a '.' after * some tags to make sure we will be able to distinguish one phrase from * the other in the text/* w w w . ja va 2 s. co m*/ * @param htmlDoc */ @SuppressWarnings("unchecked") private void replaceSeparatorTags(Document htmlDoc) { for (String tag : SEPARATOR_TAGS) { List<Element> nodes = (List<Element>) htmlDoc.selectNodes("//" + tag.toUpperCase()); for (Element node : nodes) { try { // The 'separator' must be created each time inside the for, // else there is a 'already have a parent' conflict Node separator = DOMDocumentFactory.getInstance().createText(SEPARATOR); node.add(separator); } catch (Exception e) { logger.debug("Ignoring exception, not appending at " + node.getPath()); continue; } } } }
From source file:org.dom4j.samples.dom.NativeDOMDemo.java
License:Open Source License
protected void parseDOM(String xmlFile) throws Exception { println("Loading document: " + xmlFile); SAXReader reader = new SAXReader(DOMDocumentFactory.getInstance()); Document document = reader.read(xmlFile); println("Created <dom4j> document: " + document); if (document instanceof org.w3c.dom.Document) { org.w3c.dom.Document domDocument = (org.w3c.dom.Document) document; println("Created W3C DOM document: " + domDocument); processDOM(domDocument);//from www . ja v a 2 s .c om } else { println("FAILED to make a native W3C DOM document!!"); } }
From source file:org.dom4j.samples.dom.XSLTNativeDOMDemo.java
License:Open Source License
protected Document parse(String url) throws Exception { SAXReader reader = new SAXReader(DOMDocumentFactory.getInstance()); return reader.read(url); }
From source file:org.evosuite.ClientProcess.java
License:Open Source License
private static void handleShadingSpecialCases() { String shadePrefix = PackageInfo.getShadedPackageForThirdPartyLibraries() + "."; if (!DocumentFactory.class.getName().startsWith(shadePrefix)) { //if not shaded (eg in system tests), then nothing to do return;// ww w . j a va2 s . co m } String defaultFactory = System.getProperty("org.dom4j.factory", "org.dom4j.DocumentFactory"); String defaultDomSingletonClass = System.getProperty("org.dom4j.dom.DOMDocumentFactory.singleton.strategy", "org.dom4j.util.SimpleSingleton"); String defaultSingletonClass = System.getProperty("org.dom4j.DocumentFactory.singleton.strategy", "org.dom4j.util.SimpleSingleton"); System.setProperty("org.dom4j.factory", shadePrefix + defaultFactory); System.setProperty("org.dom4j.dom.DOMDocumentFactory.singleton.strategy", shadePrefix + defaultDomSingletonClass); System.setProperty("org.dom4j.DocumentFactory.singleton.strategy", shadePrefix + defaultSingletonClass); DocumentFactory.getInstance(); //force loading DOMDocumentFactory.getInstance(); //restore in case SUT uses its own dom4j System.setProperty("org.dom4j.factory", defaultFactory); System.setProperty("org.dom4j.dom.DOMDocumentFactory.singleton.strategy", defaultDomSingletonClass); System.setProperty("org.dom4j.DocumentFactory.singleton.strategy", defaultSingletonClass); }
From source file:org.pentaho.commons.connection.DataUtilities.java
License:Open Source License
/** * Get an XML representation of the resultset * /*from www . j a v a2s. co m*/ * @return String containing XML which represents the data (eg for use with xquery) */ public static String getXMLString(IPentahoResultSet resultSet) { String xmlResultString = null; Document document = DOMDocumentFactory.getInstance().createDocument(); org.dom4j.Element resultSetNode = document.addElement("result-set"); //$NON-NLS-1$ Object[] colHeaders = resultSet.getMetaData().getColumnHeaders()[0]; String metaDataStr = ""; //$NON-NLS-1$ Object[] firstDataRow = resultSet.getDataRow(0); for (int i = 0; i < firstDataRow.length; i++) { metaDataStr += firstDataRow[i].getClass().getName() + (i == firstDataRow.length - 1 ? "" : ","); //$NON-NLS-1$//$NON-NLS-2$ } resultSetNode.addComment(metaDataStr); int rowCount = resultSet.getRowCount(); for (int i = 0; i < rowCount; i++) { Object[] row = resultSet.getDataRow(i); org.dom4j.Element rowNode = resultSetNode.addElement("row"); //$NON-NLS-1$ for (int j = 0; j < row.length; j++) { String column = colHeaders[j].toString(); String value = row[j] != null ? row[j].toString() : ""; //$NON-NLS-1$ if (row[j] instanceof Timestamp || row[j] instanceof Date) { value = String.valueOf(((Timestamp) row[j]).getTime()); } org.dom4j.Element dataNode = rowNode.addElement(column); dataNode.setText(value); } } OutputFormat format = OutputFormat.createPrettyPrint(); ByteArrayOutputStream outStream = new ByteArrayOutputStream(); try { XMLWriter writer = new XMLWriter(outStream, format); writer.write(document); xmlResultString = outStream.toString(); } catch (Exception e) { // try to return the xml unformatted xmlResultString = document.asXML(); } return xmlResultString; }
From source file:org.pentaho.jfreereport.wizard.utility.report.ReportGenerationUtility.java
License:Open Source License
/** * From the report description in the <param>reportSpec</param> parameter, create * a JFree Report report definition in XML format, and return the XML via * the <param>outputStream</param> parameter. * /*from ww w. j a v a 2 s .c o m*/ * @param reportSpec * @param outputStream * @param encoding * @param pageWidth * @param pageHeight * @param createTotalColumn * @param totalColumnName * @param totalColumnWidth * @param spacerWidth */ public static void createJFreeReportXML(ReportSpec reportSpec, OutputStream outputStream, String encoding, int pageWidth, int pageHeight, boolean createTotalColumn, String totalColumnName, int totalColumnWidth, int spacerWidth) { Field fields[] = reportSpec.getField(); Field details[] = ReportSpecUtility.getDetails(fields); Field groups[] = ReportSpecUtility.getGroups(fields); List spaceFields = setupSpaceFields(fields); try { boolean expressionExists = ReportSpecUtility.doesExpressionExist(fields); setupDetailFieldWidths(reportSpec, details); int itemRowHeight = ReportSpecUtility.getRowHeight(reportSpec, details); // dom4j Document document = DOMDocumentFactory.getInstance().createDocument(); document.addDocType("report", "-//JFreeReport//DTD report definition//EN//simple/version 0.8.5", //$NON-NLS-1$//$NON-NLS-2$ "http://jfreereport.sourceforge.net/report-085.dtd"); //$NON-NLS-1$ org.dom4j.Element reportNode = document.addElement("report"); //$NON-NLS-1$ Element configuration = reportNode.addElement(CONFIGURATION_ELEMENT_NAME); if (null != encoding) { document.setXMLEncoding(encoding); addEncoding(configuration, encoding); } // reportNode.addAttribute("xmlns", "http://jfreereport.sourceforge.net/namespaces/reports/legacy/simple"); // add parser-config to generated report addParserConfig(reportSpec, reportNode); // set report name reportNode.addAttribute(NAME_ATTRIBUTE_NAME, StringEscapeUtils.escapeXml(reportSpec.getReportName())); // set orientation reportNode.addAttribute("orientation", reportSpec.getOrientation()); //$NON-NLS-1$ // set page-format or page width/height setPageFormat(reportSpec, reportNode, pageWidth, pageHeight); // set margins setMargins(reportSpec, reportNode); if (reportSpec.getIncludeSrc() != null && !"".equalsIgnoreCase(reportSpec.getIncludeSrc())) { //$NON-NLS-1$ org.dom4j.Element includeElement = reportNode.addElement("include"); //$NON-NLS-1$ includeElement.addAttribute("src", "file://" + reportSpec.getIncludeSrc().replace('\\', '/')); //$NON-NLS-1$ //$NON-NLS-2$ } // set watermark setWatermark(reportSpec, reportNode); Element groupsNode = reportNode.addElement("groups"); //$NON-NLS-1$ Element itemsNode = reportNode.addElement("items"); //$NON-NLS-1$ Element functionNode = reportNode.addElement("functions"); //$NON-NLS-1$ if (reportSpec.getChart() != null && reportSpec.getUseChart()) { Element reportHeaderElement = reportNode.addElement("reportheader"); //$NON-NLS-1$ addChartElement(reportSpec, null, functionNode, reportHeaderElement, 0); } setItemsFont(reportSpec, itemsNode); // create banding rectangle if banding is turned on createRowBanding(reportSpec, details, itemsNode, functionNode, itemRowHeight); // programatically create details section processDetailsSection(reportSpec, details, groups, itemsNode, functionNode, itemRowHeight); // programatically create groups section processGroupsSection(reportSpec, details, groups, groupsNode, functionNode, itemRowHeight, expressionExists, spacerWidth); // spit out report xml definition OutputFormat format = OutputFormat.createPrettyPrint(); if (null != encoding) { format.setEncoding(encoding); // TODO sbarkull, not sure this is necessary } XMLWriter writer = new XMLWriter(outputStream, format); writer.write(document); writer.close(); // put _SPACE_ fields back in place as they were for (int i = 0; i < spaceFields.size(); i++) { Field f = (Field) spaceFields.get(i); f.setName("_SPACE_" + (i + 1)); //$NON-NLS-1$ f.setDisplayName("_SPACE_" + (i + 1)); //$NON-NLS-1$ } } catch (Exception e) { getLogger().error(e.getMessage(), e); } }
From source file:org.pentaho.platform.plugin.adhoc.AdhocContentGenerator.java
License:Open Source License
public void createMQLQueryActionSequence(final String domainId, final String modelId, final String tableId, final String columnId, final String searchStr, final OutputStream outputStream, final String userSessionName) throws IOException { Document document = DOMDocumentFactory.getInstance().createDocument(); document.setXMLEncoding(LocaleHelper.getSystemEncoding()); Element actionSeqElement = document.addElement("action-sequence"); //$NON-NLS-1$ actionSeqElement.addElement("version").setText("1"); //$NON-NLS-1$ //$NON-NLS-2$ actionSeqElement.addElement("title").setText("MQL Query"); //$NON-NLS-1$ //$NON-NLS-2$ actionSeqElement.addElement("logging-level").setText("ERROR"); //$NON-NLS-1$ //$NON-NLS-2$ Element documentationElement = actionSeqElement.addElement("documentation"); //$NON-NLS-1$ Element authorElement = documentationElement.addElement("author"); //$NON-NLS-1$ if (userSessionName != null) { authorElement.setText(userSessionName); } else {/*from w ww . j a v a2 s. co m*/ authorElement.setText("Web Query & Reporting"); //$NON-NLS-1$ } documentationElement.addElement("description") //$NON-NLS-1$ .setText("Temporary action sequence used by Web Query & Reporting"); //$NON-NLS-1$ documentationElement.addElement("result-type").setText("result-set"); //$NON-NLS-1$ //$NON-NLS-2$ Element outputsElement = actionSeqElement.addElement("outputs"); //$NON-NLS-1$ Element reportTypeElement = outputsElement.addElement("query_result"); //$NON-NLS-1$ reportTypeElement.addAttribute("type", "result-set"); //$NON-NLS-1$ //$NON-NLS-2$ Element destinationsElement = reportTypeElement.addElement("destinations"); //$NON-NLS-1$ destinationsElement.addElement("response").setText("query_result"); //$NON-NLS-1$ //$NON-NLS-2$ Element actionsElement = actionSeqElement.addElement("actions"); //$NON-NLS-1$ Element actionDefinitionElement = actionsElement.addElement("action-definition"); //$NON-NLS-1$ Element actionOutputsElement = actionDefinitionElement.addElement("action-outputs"); //$NON-NLS-1$ Element ruleResultElement = actionOutputsElement.addElement("query-result"); //$NON-NLS-1$ ruleResultElement.addAttribute("type", "result-set"); //$NON-NLS-1$ //$NON-NLS-2$ ruleResultElement.addAttribute("mapping", "query_result"); //$NON-NLS-1$ //$NON-NLS-2$ actionDefinitionElement.addElement("component-name").setText("MQLRelationalDataComponent"); //$NON-NLS-1$ //$NON-NLS-2$ actionDefinitionElement.addElement("action-type").setText("MQL Query"); //$NON-NLS-1$ //$NON-NLS-2$ Element componentDefinitionElement = actionDefinitionElement.addElement("component-definition"); //$NON-NLS-1$ // log SQL flag if ("true".equals(PentahoSystem.getSystemSetting("adhoc-preview-log-sql", "false"))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ componentDefinitionElement.addElement("logSql").addCDATA("true"); //$NON-NLS-1$ //$NON-NLS-2$ } // componentDefinitionElement.addElement("query").addCDATA(createMQLQueryXml(domainId, modelId, tableId, columnId, searchStr)); //$NON-NLS-1$ addMQLQueryXml(componentDefinitionElement, domainId, modelId, tableId, columnId, searchStr); // end action-definition for JFreeReportComponent OutputFormat format = OutputFormat.createPrettyPrint(); format.setEncoding(LocaleHelper.getSystemEncoding()); XMLWriter writer = new XMLWriter(outputStream, format); writer.write(document); writer.close(); }
From source file:org.pentaho.platform.plugin.adhoc.AdhocContentGenerator.java
License:Open Source License
public ByteArrayOutputStream createMQLReportActionSequenceAsStream(final String reportName, final String reportDescription, final Element mqlNode, final String[] outputTypeList, final String xactionName, final String jfreeReportXML, final String jfreeReportFilename, final String loggingLevel, final IPentahoSession userSession) throws IOException, AdhocWebServiceException { boolean bIsMultipleOutputType = outputTypeList.length > 1; Document document = DOMDocumentFactory.getInstance().createDocument(); document.setXMLEncoding(LocaleHelper.getSystemEncoding()); Element actionSeqElement = document.addElement("action-sequence"); //$NON-NLS-1$ Element actionSeqNameElement = actionSeqElement.addElement("name"); //$NON-NLS-1$ actionSeqNameElement.setText(xactionName); Element actionSeqVersionElement = actionSeqElement.addElement("version"); //$NON-NLS-1$ actionSeqVersionElement.setText("1"); //$NON-NLS-1$ Element actionSeqTitleElement = actionSeqElement.addElement("title"); //$NON-NLS-1$ String reportTitle = AdhocContentGenerator.getBaseFilename(reportName); // remove ".waqr.xreportspec" if it is there actionSeqTitleElement.setText(reportTitle); Element loggingLevelElement = actionSeqElement.addElement("logging-level"); //$NON-NLS-1$ loggingLevelElement.setText(loggingLevel); Element documentationElement = actionSeqElement.addElement("documentation"); //$NON-NLS-1$ Element authorElement = documentationElement.addElement("author"); //$NON-NLS-1$ if (userSession.getName() != null) { authorElement.setText(userSession.getName()); } else {/*from ww w . j av a 2 s .c o m*/ authorElement.setText("Web Query & Reporting"); //$NON-NLS-1$ } Element descElement = documentationElement.addElement("description"); //$NON-NLS-1$ descElement.setText(reportDescription); Element iconElement = documentationElement.addElement("icon"); //$NON-NLS-1$ iconElement.setText("PentahoReporting.png"); //$NON-NLS-1$ Element helpElement = documentationElement.addElement("help"); //$NON-NLS-1$ helpElement.setText("Auto-generated action-sequence for WAQR."); //$NON-NLS-1$ Element resultTypeElement = documentationElement.addElement("result-type"); //$NON-NLS-1$ resultTypeElement.setText("report"); //$NON-NLS-1$ // inputs Element inputsElement = actionSeqElement.addElement("inputs"); //$NON-NLS-1$ Element outputTypeElement = inputsElement.addElement("output-type"); //$NON-NLS-1$ outputTypeElement.addAttribute("type", "string"); //$NON-NLS-1$ //$NON-NLS-2$ Element defaultValueElement = outputTypeElement.addElement("default-value"); //$NON-NLS-1$ defaultValueElement.setText(outputTypeList[0]); Element sourcesElement = outputTypeElement.addElement("sources"); //$NON-NLS-1$ Element requestElement = sourcesElement.addElement(HttpRequestParameterProvider.SCOPE_REQUEST); requestElement.setText("type"); //$NON-NLS-1$ if (bIsMultipleOutputType) { // define list of report output-file extensions (html, pdf, xls, csv) /* * <mimeTypes type="string-list"> <sources> <request>mimeTypes</request> </sources> <default-value type="string-list"> <list-item>html</list-item> <list-item>pdf</list-item> <list-item>xls</list-item> <list-item>csv</list-item> * </default-value> </mimeTypes> */ Element mimeTypes = inputsElement.addElement("mimeTypes");//$NON-NLS-1$ mimeTypes.addAttribute("type", "string-list"); //$NON-NLS-1$ //$NON-NLS-2$ Element sources = mimeTypes.addElement("sources");//$NON-NLS-1$ requestElement = sources.addElement("request"); //$NON-NLS-1$ requestElement.setText("mimeTypes"); //$NON-NLS-1$ Element defaultValue = mimeTypes.addElement("default-value"); //$NON-NLS-1$ defaultValue.addAttribute("type", "string-list"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-1$ Element listItem = null; for (String outputType : outputTypeList) { listItem = defaultValue.addElement("list-item"); //$NON-NLS-1$ listItem.setText(outputType); } } // outputs Element outputsElement = actionSeqElement.addElement("outputs"); //$NON-NLS-1$ Element reportTypeElement = outputsElement.addElement("report"); //$NON-NLS-1$ reportTypeElement.addAttribute("type", "content"); //$NON-NLS-1$ //$NON-NLS-2$ Element destinationsElement = reportTypeElement.addElement("destinations"); //$NON-NLS-1$ Element responseElement = destinationsElement.addElement("response"); //$NON-NLS-1$ responseElement.setText("content"); //$NON-NLS-1$ // resources Element resourcesElement = actionSeqElement.addElement("resources"); //$NON-NLS-1$ Element reportDefinitionElement = resourcesElement.addElement("report-definition"); //$NON-NLS-1$ Element solutionFileElement = null; if (null == jfreeReportFilename) { // likely they are running a preview solutionFileElement = reportDefinitionElement.addElement("xml"); //$NON-NLS-1$ Element locationElement = solutionFileElement.addElement("location"); //$NON-NLS-1$ Document jfreeReportDoc = null; try { jfreeReportDoc = XmlDom4JHelper.getDocFromString(jfreeReportXML, new PentahoEntityResolver()); } catch (XmlParseException e) { String msg = Messages.getInstance() .getErrorString("HttpWebService.ERROR_0001_ERROR_DURING_WEB_SERVICE"); //$NON-NLS-1$ error(msg, e); throw new AdhocWebServiceException(msg, e); } Node reportNode = jfreeReportDoc.selectSingleNode("/report"); //$NON-NLS-1$ locationElement.add(reportNode); } else { // likely they are saving the report solutionFileElement = reportDefinitionElement.addElement("solution-file"); //$NON-NLS-1$ Element locationElement = solutionFileElement.addElement("location"); //$NON-NLS-1$ locationElement.setText(jfreeReportFilename); } Element mimeTypeElement = solutionFileElement.addElement("mime-type"); //$NON-NLS-1$ mimeTypeElement.setText("text/xml"); //$NON-NLS-1$ Element actionsElement = actionSeqElement.addElement("actions"); //$NON-NLS-1$ Element actionDefinitionElement = null; if (bIsMultipleOutputType) // do secure filter { // begin action-definition for Secure Filter /* * <action-definition> <component-name>SecureFilterComponent</component-name> <action-type>Prompt/Secure Filter</action-type> <action-inputs> <output-type type="string"/> <mimeTypes type="string-list"/> </action-inputs> * <component-definition> <selections> <output-type prompt-if-one-value="true"> <title>Select output type:</title> <filter>mimeTypes</filter> </output-type> </selections> </component-definition> </action-definition> */ actionDefinitionElement = actionsElement.addElement("action-definition"); //$NON-NLS-1$ Element componentName = actionDefinitionElement.addElement("component-name"); //$NON-NLS-1$ componentName.setText("SecureFilterComponent"); //$NON-NLS-1$ Element actionType = actionDefinitionElement.addElement("action-type"); //$NON-NLS-1$ actionType.setText("Prompt/Secure Filter"); //$NON-NLS-1$ Element actionInputs = actionDefinitionElement.addElement("action-inputs"); //$NON-NLS-1$ Element outputType = actionInputs.addElement("output-type"); //$NON-NLS-1$ outputType.addAttribute("type", "string"); //$NON-NLS-1$ //$NON-NLS-2$ Element mimeTypes = actionInputs.addElement("mimeTypes"); //$NON-NLS-1$ mimeTypes.addAttribute("type", "string-list"); //$NON-NLS-1$ //$NON-NLS-2$ Element componentDefinition = actionDefinitionElement.addElement("component-definition"); //$NON-NLS-1$ Element selections = componentDefinition.addElement("selections"); //$NON-NLS-1$ outputType = selections.addElement("output-type"); //$NON-NLS-1$ outputType.addAttribute("prompt-if-one-value", "true"); //$NON-NLS-1$ //$NON-NLS-2$ Element title = outputType.addElement("title"); //$NON-NLS-1$ String prompt = Messages.getInstance().getString("AdhocWebService.SELECT_OUTPUT_TYPE");//$NON-NLS-1$ title.setText(prompt); Element filter = outputType.addElement("filter"); //$NON-NLS-1$ filter.setText("mimeTypes"); //$NON-NLS-1$ } // begin action-definition for SQLLookupRule actionDefinitionElement = actionsElement.addElement("action-definition"); //$NON-NLS-1$ Element actionOutputsElement = actionDefinitionElement.addElement("action-outputs"); //$NON-NLS-1$ Element ruleResultElement = actionOutputsElement.addElement("rule-result"); //$NON-NLS-1$ ruleResultElement.addAttribute("type", "result-set"); //$NON-NLS-1$ //$NON-NLS-2$ Element componentNameElement = actionDefinitionElement.addElement("component-name"); //$NON-NLS-1$ componentNameElement.setText("MQLRelationalDataComponent"); //$NON-NLS-1$ Element actionTypeElement = actionDefinitionElement.addElement("action-type"); //$NON-NLS-1$ actionTypeElement.setText("rule"); //$NON-NLS-1$ Element componentDefinitionElement = actionDefinitionElement.addElement("component-definition"); //$NON-NLS-1$ componentDefinitionElement.add(mqlNode); componentDefinitionElement.addElement("live").setText("true"); //$NON-NLS-1$ //$NON-NLS-2$ componentDefinitionElement.addElement("display-names").setText("false"); //$NON-NLS-1$ //$NON-NLS-2$ // log SQL flag if ("true".equals(PentahoSystem.getSystemSetting("adhoc-preview-log-sql", "false"))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ componentDefinitionElement.addElement("logSql").addCDATA("true"); //$NON-NLS-1$ //$NON-NLS-2$ } // end action-definition for SQLLookupRule // begin action-definition for JFreeReportComponent actionDefinitionElement = actionsElement.addElement("action-definition"); //$NON-NLS-1$ actionOutputsElement = actionDefinitionElement.addElement("action-outputs"); //$NON-NLS-1$ Element actionInputsElement = actionDefinitionElement.addElement("action-inputs"); //$NON-NLS-1$ outputTypeElement = actionInputsElement.addElement("output-type"); //$NON-NLS-1$ outputTypeElement.addAttribute("type", "string"); //$NON-NLS-1$ //$NON-NLS-2$ Element dataElement = actionInputsElement.addElement("data"); //$NON-NLS-1$ Element actionResourcesElement = actionDefinitionElement.addElement("action-resources"); //$NON-NLS-1$ Element reportDefinition = actionResourcesElement.addElement("report-definition"); //$NON-NLS-1$ reportDefinition.addAttribute("type", "resource"); //$NON-NLS-1$ //$NON-NLS-2$ dataElement.addAttribute("type", "result-set"); //$NON-NLS-1$ //$NON-NLS-2$ dataElement.addAttribute("mapping", "rule-result"); //$NON-NLS-1$ //$NON-NLS-2$ Element reportOutputElement = actionOutputsElement.addElement("report"); //$NON-NLS-1$ reportOutputElement.addAttribute("type", "content"); //$NON-NLS-1$ //$NON-NLS-2$ componentNameElement = actionDefinitionElement.addElement("component-name"); //$NON-NLS-1$ componentNameElement.setText("JFreeReportComponent"); //$NON-NLS-1$ actionTypeElement = actionDefinitionElement.addElement("action-type"); //$NON-NLS-1$ actionTypeElement.setText("report"); //$NON-NLS-1$ componentDefinitionElement = actionDefinitionElement.addElement("component-definition"); //$NON-NLS-1$ componentDefinitionElement.addElement("output-type").setText(outputTypeList[0]); //$NON-NLS-1$ Document tmp = customizeActionSequenceDocument(document); if (tmp != null) { document = tmp; } return exportDocumentAsByteArrayOutputStream(document); }