Package org.pentaho.reporting.libraries.xmlns.writer

Examples of org.pentaho.reporting.libraries.xmlns.writer.XmlWriter


    final OutputStream outputStream = new BufferedOutputStream(bundle.createEntry(contentFileState.getFileName(),
        "text/xml"));
    final Configuration globalConfig = ClassicEngineBoot.getInstance().getGlobalConfig();
    final DefaultTagDescription tagDescription = new DefaultTagDescription(globalConfig,
        BundleXmlModule.TAG_DEF_PREFIX);
    final XmlWriter writer = new XmlWriter
        (new OutputStreamWriter(outputStream, "UTF-8"), tagDescription, "  ", "\n");
    writer.writeXmlDeclaration("UTF-8");

    final AttributeList rootAttributes = new AttributeList();
    rootAttributes.addNamespaceDeclaration("", BundleNamespaces.CONTENT);

    writer.writeTag(BundleNamespaces.CONTENT, "content", rootAttributes, XmlWriterSupport.OPEN);

    writer.writeComment(" The content.xml file remains intentionally empty. This file can be used to ");
    writer.writeComment(" inject global templates later. ");

    writer.writeCloseTag();
    writer.close();
    return contentFileState.getFileName();


  }
View Full Code Here


    }

    final OutputStream outputStream = new BufferedOutputStream(bundle.createEntry("settings.xml", "text/xml"));
    final DefaultTagDescription tagDescription = new DefaultTagDescription(
        ClassicEngineBoot.getInstance().getGlobalConfig(), BundleXmlModule.TAG_DEF_PREFIX);
    final XmlWriter writer = new XmlWriter(new OutputStreamWriter(outputStream, "UTF-8"), tagDescription, "  ", "\n");
    writer.writeXmlDeclaration("UTF-8");

    final AttributeList rootAttributes = new AttributeList();
    rootAttributes.addNamespaceDeclaration("", BundleNamespaces.SETTINGS);

    writer.writeTag(BundleNamespaces.SETTINGS, "settings", rootAttributes, XmlWriterSupport.OPEN);

    writeConfiguration(state, writer);
    writeRuntimeInformation(state, writer);

    writer.writeCloseTag();
    writer.close();

    return "settings.xml";
  }
View Full Code Here

    final String encoding = metaData.getConfiguration().getConfigProperty
        ("org.pentaho.reporting.engine.classic.core.modules.output.pageable.xml.Encoding",
            EncodingRegistry.getPlatformDefaultEncoding());

    final Writer writer = new BufferedWriter(new OutputStreamWriter(outputStream, encoding));
    this.xmlWriter = new XmlWriter(writer, td);
    this.xmlWriter.writeXmlDeclaration(null);
    final AttributeList attrs = new AttributeList();
    attrs.addNamespaceDeclaration("", XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE);
    xmlWriter.writeTag(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "layout-output", attrs, XmlWriter.OPEN);
  }
View Full Code Here

   * @throws ReportWriterException if there is a problem writing the report.
   */
  public void write()
      throws IOException, ReportWriterException
  {
    final XmlWriter writer = getXmlWriter();
    writer.writeTag(ExtParserModule.NAMESPACE, ReportDescriptionWriter.REPORT_DESCRIPTION_TAG, XmlWriterSupport.OPEN);

    writeRootBand(ReportDescriptionWriter.REPORT_HEADER_TAG, getReport().getReportHeader());
    writeRootBand(ReportDescriptionWriter.REPORT_FOOTER_TAG, getReport().getReportFooter());
    writeRootBand(ReportDescriptionWriter.PAGE_HEADER_TAG, getReport().getPageHeader());
    writeRootBand(ReportDescriptionWriter.PAGE_FOOTER_TAG, getReport().getPageFooter());
    writeRootBand(ReportDescriptionWriter.WATERMARK_TAG, getReport().getWatermark());
    writeGroups();
    writeRootBand(ReportDescriptionWriter.ITEMBAND_TAG, getReport().getItemBand());
    writeRootBand(ReportDescriptionWriter.NO_DATA_BAND_TAG, getReport().getNoDataBand());

    writer.writeCloseTag();
  }
View Full Code Here

   */
  private void writeBand(final String tagName,
                         final Band band)
      throws IOException, ReportWriterException
  {
    final XmlWriter writer = getXmlWriter();
    if (band.getName().startsWith(Band.ANONYMOUS_BAND_PREFIX) ||
        band.getName().startsWith(Element.ANONYMOUS_ELEMENT_PREFIX))
    {
      writer.writeTag(ExtParserModule.NAMESPACE, tagName, XmlWriterSupport.OPEN);
    }
    else
    {
      writer.writeTag(ExtParserModule.NAMESPACE, tagName,
          "name", band.getName(), XmlWriterSupport.OPEN);
    }

    writeStyleInfo(band);

    final Element[] list = band.getElementArray();
    for (int i = 0; i < list.length; i++)
    {
      if (list[i] instanceof Band)
      {
        final Band b = (Band) list[i];
        writeBand(ReportDescriptionWriter.BAND_TAG, b);
      }
      else
      {
        writeElement(list[i]);
      }
    }

    if (band instanceof RootLevelBand)
    {
      writeSubReports((RootLevelBand) band);
    }

    writer.writeCloseTag();
  }
View Full Code Here

  }

  private void writeStyleInfo(final Element band)
      throws IOException, ReportWriterException
  {
    final XmlWriter writer = getXmlWriter();
    final ElementStyleSheet styleSheet = band.getStyle();
    if (isStyleSheetEmpty(styleSheet) == false)
    {
      writer.writeTag(ExtParserModule.NAMESPACE, AbstractXMLDefinitionWriter.STYLE_TAG, XmlWriterSupport.OPEN);

      final StyleWriter styleWriter =
          new StyleWriter(getReportWriter(), band.getStyle(), writer);
      styleWriter.write();
      writer.writeCloseTag();
    }


    final Map styleExpressions = band.getStyleExpressions();
    final Iterator styleExpressionsIt = styleExpressions.entrySet().iterator();
View Full Code Here

    if (element.getName().startsWith(Element.ANONYMOUS_ELEMENT_PREFIX) == false)
    {
      attList.setAttribute(ExtParserModule.NAMESPACE, "name", element.getName());
    }

    final XmlWriter writer = getXmlWriter();
    writer.writeTag(ExtParserModule.NAMESPACE, ReportDescriptionWriter.ELEMENT_TAG, attList, XmlWriterSupport.OPEN);

    writeStyleInfo(element);
    writeDataSourceForElement(element);

    writer.writeCloseTag();
  }
View Full Code Here

    if (dsname == null)
    {
      throw new ReportWriterException("No name for DataSource " + datasource);
    }

    final XmlWriter writer = getXmlWriter();
    writer.writeTag(ExtParserModule.NAMESPACE,
        AbstractXMLDefinitionWriter.DATASOURCE_TAG, "type", dsname, XmlWriterSupport.OPEN);

    final DataSourceWriter dsWriter =
        new DataSourceWriter(reportWriter, datasource, od, writer);
    dsWriter.write();

    writer.writeCloseTag();
  }
View Full Code Here

   * @throws ReportWriterException if there is a problem writing the report.
   */
  private void writeGroups()
      throws IOException, ReportWriterException
  {
    final XmlWriter writer = getXmlWriter();
    writer.writeTag(ExtParserModule.NAMESPACE, ReportDescriptionWriter.GROUPS_TAG, XmlWriterSupport.OPEN);

    //logComment = true;
    final int groupSize = getReport().getGroupCount();
    for (int i = 0; i < groupSize; i++)
    {

      // todo: This is probably not correct.
      final RelationalGroup g = (RelationalGroup) getReport().getGroup(i);
      writer.writeTag(ExtParserModule.NAMESPACE, ReportDescriptionWriter.GROUP_TAG,
          "name", g.getName(), XmlWriterSupport.OPEN);

      final List fields = g.getFields();
      if (fields.isEmpty() == false)
      {
        writer.writeTag(ExtParserModule.NAMESPACE, ReportDescriptionWriter.FIELDS_TAG, XmlWriterSupport.OPEN);

        for (int f = 0; f < fields.size(); f++)
        {
          final String field = (String) fields.get(f);
          writer.writeTag(ExtParserModule.NAMESPACE, ReportDescriptionWriter.FIELD_TAG, XmlWriterSupport.OPEN);
          writer.writeTextNormalized(field, false);
          writer.writeCloseTag();
        }
        writer.writeCloseTag();
      }
      else
      {
        writer.writeTag(ExtParserModule.NAMESPACE, ReportDescriptionWriter.FIELDS_TAG, XmlWriterSupport.CLOSE);
      }

      writeRootBand(ReportDescriptionWriter.GROUP_HEADER_TAG, g.getHeader());
      writeRootBand(ReportDescriptionWriter.GROUP_FOOTER_TAG, g.getFooter());

      writer.writeCloseTag();
    }

    writer.writeCloseTag();
  }
View Full Code Here

   * @throws ReportWriterException if there is a problem writing the report.
   */
  public void write(final Writer w)
      throws IOException, ReportWriterException
  {
    final XmlWriter xmlWriter = new XmlWriter(w, createTagDescription());

    xmlWriter.writeXmlDeclaration(getEncoding());
    final ReportDefinitionWriter writer = new ReportDefinitionWriter(this, xmlWriter);
    writer.write();
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.xmlns.writer.XmlWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.