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

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


    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

        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

      this.xmlWriter.close();
      return;
    }


    final XmlWriter docWriter = new XmlWriter(writer, xmlWriter.getTagDescription());
    docWriter.addImpliedNamespace(HtmlPrinter.XHTML_NAMESPACE, "");
    docWriter.setHtmlCompatiblityMode(true);

    if (styleFile != null)
    {
      // now its time to write the header with the link to the style-sheet-file
      writeCompleteHeader(docWriter, writer, contentProducer, logicalPageBox, styleFileUrl, null);
    }
    else
    {
      writeCompleteHeader(docWriter, writer, contentProducer, logicalPageBox, null, styleManager);
    }

    xmlWriter.writeCloseTag(); // for the body ..
    xmlWriter.flush();

    // no need to check for IOExceptions here, as we know the implementation does not create such things
    final MemoryStringReader stringReader = bufferWriter.createReader();
    docWriter.writeStream(stringReader);
    stringReader.close();

    docWriter.writeCloseTag(); // for the html ..
    docWriter.close();
  }
View Full Code Here

   *                             if the report serialisation failed.
   */
  public void write() throws IOException, ReportWriterException
  {
    final SubReport report = (SubReport) getReport();
    final XmlWriter xmlWriter = getXmlWriter();

    final AttributeList attList = new AttributeList();
    if (getReportWriter().hasParent() == false)
    {
      attList.addNamespaceDeclaration("", ExtParserModule.NAMESPACE);
    }

    final String query = report.getQuery();
    if (query != null)
    {
      attList.setAttribute(ExtParserModule.NAMESPACE, "query", query);
    }
    xmlWriter.writeTag(ExtParserModule.NAMESPACE,
        "sub-report", attList, XmlWriterSupport.OPEN);

    writeParameterDeclaration();

    // no need to write the parser config, if this subreport is inlined.
    if (getReportWriter().hasParent() == false)
    {
      final ParserConfigWriter parserConfigWriter =
          new ParserConfigWriter(getReportWriter(), xmlWriter);
      parserConfigWriter.write();
    }

    final ReportConfigWriter reportConfigWriter =
        new ReportConfigWriter(getReportWriter(), xmlWriter);
    reportConfigWriter.write();

    final StylesWriter stylesWriter =
        new StylesWriter(getReportWriter(), xmlWriter);
    stylesWriter.write();

    final ReportDescriptionWriter reportDescriptionWriter
        = new ReportDescriptionWriter(getReportWriter(), xmlWriter);
    reportDescriptionWriter.write();

    final FunctionsWriter functionsWriter =
        new FunctionsWriter(getReportWriter(), xmlWriter);
    functionsWriter.write();
    xmlWriter.writeCloseTag();
  }
View Full Code Here

    {
      throw new ReportWriterException("The datasource type is not registered: "
          + ds.getClass());
    }

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

    final DataSourceWriter dsWriter =
        new DataSourceWriter(getReportWriter(), ds, dsDesc, writer);
    dsWriter.write();
    writer.writeCloseTag();
  }
View Full Code Here

    }

    final OutputStream outputStream = bundle.createEntry(fileName, "text/xml");
    final DefaultTagDescription tagDescription = new DefaultTagDescription(
        ClassicEngineBoot.getInstance().getGlobalConfig(), SQLDataFactoryModule.TAG_DEF_PREFIX);
    final XmlWriter xmlWriter = new XmlWriter(new OutputStreamWriter(outputStream, "UTF-8"), tagDescription, "  ",
        "\n");
    final AttributeList rootAttrs = new AttributeList();
    rootAttrs.addNamespaceDeclaration("data", SQLDataFactoryModule.NAMESPACE);
    xmlWriter.writeTag(SQLDataFactoryModule.NAMESPACE, "sql-datasource", rootAttrs, XmlWriterSupport.OPEN);

    final AttributeList configAttrs = new AttributeList();
    configAttrs.setAttribute(SQLDataFactoryModule.NAMESPACE, "user-field", sqlDataFactory.getUserField());
    configAttrs.setAttribute(SQLDataFactoryModule.NAMESPACE, "password-field", sqlDataFactory.getPasswordField());
    configAttrs.setAttribute(SQLDataFactoryModule.NAMESPACE, "label-mapping",
        String.valueOf(sqlDataFactory.isLabelMapping()));
    xmlWriter.writeTag(SQLDataFactoryModule.NAMESPACE, "config", configAttrs, XmlWriterSupport.CLOSE);

    writeConnectionInfo(bundle, state, xmlWriter, sqlDataFactory.getConnectionProvider());

    final String[] queryNames = sqlDataFactory.getQueryNames();
    for (int i = 0; i < queryNames.length; i++)
    {
      final String queryName = queryNames[i];
      final String query = sqlDataFactory.getQuery(queryName);
      xmlWriter.writeTag(SQLDataFactoryModule.NAMESPACE, "query", "name", queryName, XmlWriterSupport.OPEN);
      xmlWriter.writeTextNormalized(query, false);
      xmlWriter.writeCloseTag();
    }

    xmlWriter.writeCloseTag();
    xmlWriter.close();

    return fileName;
  }
View Full Code Here

   */
  public void write()
      throws IOException, ReportWriterException
  {
    final ElementStyleSheet[] parents = elementStyleSheet.getParents();
    final XmlWriter writer = getXmlWriter();
    // write the parents of the stylesheet ...
    for (int p = 0; p < parents.length; p++)
    {
      final ElementStyleSheet parent = parents[p];
      if (isDefaultStyleSheet(parent) == false)
      {
        writer.writeTag(ExtParserModule.NAMESPACE, AbstractXMLDefinitionWriter.EXTENDS_TAG, "name", parent.getName(),
            XmlWriterSupport.CLOSE);
      }
    }

    // now write all defined properties of the stylesheet ...
View Full Code Here

    if (isUseKeyObjectDescription(key, o) == false)
    {
      p.setAttribute(ExtParserModule.NAMESPACE, "class", o.getClass().getName());
    }

    final XmlWriter writer = getXmlWriter();
    final List parameterNames = getParameterNames(od);
    if (isBasicKey(parameterNames, od))
    {
      writer.writeTag(ExtParserModule.NAMESPACE, AbstractXMLDefinitionWriter.BASIC_KEY_TAG, p, XmlWriterSupport.OPEN);
      writer.writeTextNormalized((String) od.getParameter("value"), false);
      writer.writeCloseTag();
    }
    else
    {
      writer.writeTag(ExtParserModule.NAMESPACE, AbstractXMLDefinitionWriter.COMPOUND_KEY_TAG, p,
          XmlWriterSupport.OPEN);
      final ObjectWriter objWriter = new ObjectWriter
          (getReportWriter(), o, od, writer);
      objWriter.write();
      writer.writeCloseTag();
    }
  }
View Full Code Here

    }

    final OutputStream outputStream = bundle.createEntry(fileName, "text/xml");
    final DefaultTagDescription tagDescription = new DefaultTagDescription(
        ClassicEngineBoot.getInstance().getGlobalConfig(), SQLDataFactoryModule.TAG_DEF_PREFIX);
    final XmlWriter xmlWriter = new XmlWriter(new OutputStreamWriter(outputStream, "UTF-8"), tagDescription, "  ",
        "\n");
    final AttributeList rootAttrs = new AttributeList();
    rootAttrs.addNamespaceDeclaration("data", SQLDataFactoryModule.NAMESPACE);
    xmlWriter.writeTag(SQLDataFactoryModule.NAMESPACE, "direct-sql-datasource", rootAttrs, XmlWriterSupport.OPEN);

    final AttributeList configAttrs = new AttributeList();
    configAttrs.setAttribute(SQLDataFactoryModule.NAMESPACE, "user-field", sqlDataFactory.getUserField());
    configAttrs.setAttribute(SQLDataFactoryModule.NAMESPACE, "password-field", sqlDataFactory.getPasswordField());   
    configAttrs.setAttribute(SQLDataFactoryModule.NAMESPACE, "label-mapping",
        String.valueOf(sqlDataFactory.isLabelMapping()));
    xmlWriter.writeTag(SQLDataFactoryModule.NAMESPACE, "config", configAttrs, XmlWriterSupport.CLOSE);

    writeConnectionInfo(bundle, state, xmlWriter, sqlDataFactory.getConnectionProvider());

    xmlWriter.writeCloseTag();
    xmlWriter.close();

    return fileName;
  }
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.