Examples of XmlWriter


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

   * @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

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

   */
  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

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

  }

  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

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

    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

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

    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

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

   * @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

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

   * @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

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

  {
    final ReportWriter writer = createWriter();
    final StaticDataSource ds = new StaticDataSource(new Line2D.Float());
    final ClassFactory cc = writer.getClassFactoryCollector();
    final Writer w = new OutputStreamWriter(new NullOutputStream(), "UTF-16");
    final XmlWriter xmlWriter = new XmlWriter(w);

    final AttributeList attList = new AttributeList();
    attList.addNamespaceDeclaration("", ExtParserModule.NAMESPACE);
    xmlWriter.writeTag(ExtParserModule.NAMESPACE, "testcase", attList, XmlWriter.OPEN);
    final DataSourceWriter dsW = new DataSourceWriter(writer,
        ds, cc.getDescriptionForClass(ds.getClass()), xmlWriter);
    dsW.write();
    xmlWriter.writeCloseTag();
    w.flush();
  }
View Full Code Here

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

    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(encoding);
    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

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

        if (isCreateBodyFragment() == false)
        {
          if (isInlineStylesRequested())
          {
            this.styleManager = new InlineStyleManager();
            this.xmlWriter = new XmlWriter(writer, td);
            this.xmlWriter.addImpliedNamespace(HtmlPrinter.XHTML_NAMESPACE, "");
            this.xmlWriter.setHtmlCompatiblityMode(true);
            writeCompleteHeader(xmlWriter, writer, contentProducer, logicalPage, null, null);
          }
          else
          {
            if (isExternalStyleSheetRequested())
            {
              this.styleFile = dataLocation.createItem(dataNameGenerator.generateName("style", "text/css"));
              this.styleFileUrl = urlRewriter.rewrite(documentContentItem, styleFile);
            }

            this.styleManager = new GlobalStyleManager();
            if (isForceBufferedWriting() == false && styleFile != null)
            {
              this.xmlWriter = new XmlWriter(writer, td);
              this.xmlWriter.addImpliedNamespace(HtmlPrinter.XHTML_NAMESPACE, "");
              this.xmlWriter.setHtmlCompatiblityMode(true);
              writeCompleteHeader(xmlWriter, writer, contentProducer, logicalPage, styleFileUrl, null);
            }
            else
            {
              this.bufferWriter = new MemoryStringWriter(1024 * 512);
              this.xmlWriter = new XmlWriter(bufferWriter, td);
              this.xmlWriter.setAdditionalIndent(1);
              this.xmlWriter.addImpliedNamespace(HtmlPrinter.XHTML_NAMESPACE, "");
              this.xmlWriter.setHtmlCompatiblityMode(true);
            }
          }

          this.xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "body", XmlWriterSupport.OPEN);
        }
        else
        {
          this.styleManager = new InlineStyleManager();
          this.xmlWriter = new XmlWriter(writer, td);
          this.xmlWriter.addImpliedNamespace(HtmlPrinter.XHTML_NAMESPACE, "");
          this.xmlWriter.setHtmlCompatiblityMode(true);
        }

        final ReportAttributeMap map = logicalPage.getAttributes();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.