Examples of StreamSource


Examples of javax.xml.transform.stream.StreamSource

        try {
            Fop fop = fopFactory.newFop(MimeConstants.MIME_RTF, foUserAgent, out);
            TransformerFactory factory = TransformerFactory.newInstance();
           
            javax.xml.transform.Transformer transformer =
                    factory.newTransformer(new StreamSource(template));
           
            transformer.setErrorListener(this);
            transformer.setParameter("versionParam", "1.0");
            transformer.transform(new StreamSource(source), new SAXResult(fop.getDefaultHandler()));
        } finally {
            out.close();
        }
    }
View Full Code Here

Examples of javax.xml.transform.stream.StreamSource

        try {
            Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
            TransformerFactory factory = TransformerFactory.newInstance();
           
            javax.xml.transform.Transformer transformer =
                    factory.newTransformer(new StreamSource(template));
           
            transformer.setErrorListener(this);
            transformer.setParameter("versionParam", "1.0");
            transformer.transform(new StreamSource(source), new SAXResult(fop.getDefaultHandler()));
        } finally {
            out.close();
        }
    }
View Full Code Here

Examples of javax.xml.transform.stream.StreamSource

     * @throws TransformerException
     */
    public static void main(String[] args) throws TransformerException, TransformerFactoryConfigurationError {
        Transformer xsl =
        TransformerFactory.newInstance().newTransformer(
                new StreamSource(new File("src/com/hp/hpl/jena/iri/impl/viol2java.xsl"))
                );
        xsl.transform(
                new StreamSource(new File("src/com/hp/hpl/jena/iri/impl/violations.xml")),
                new StreamResult(new File("src/com/hp/hpl/jena/iri/ViolationCodes.java"))
                       
        );
       
       
View Full Code Here

Examples of javax.xml.transform.stream.StreamSource

        writer.writeEndDocument();
    }
   
    public void testStreamSource() throws Exception
    {
        StreamSource s = new StreamSource(getResourceAsStream("test.xml"));
       
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(bos);
       
        writer.writeStartDocument();
View Full Code Here

Examples of javax.xml.transform.stream.StreamSource

    }

    try {
      log.debug("loading transformer ..");
      URL xslFile = getClass().getResource("/resources/xmlgui/help.xsl");
      transformer = TransformerFactory.newInstance().newTransformer(new StreamSource(xslFile.openStream()));
      transformer.setParameter("locale", locale);
    } catch (Exception e) {
      throw new HelpException("Error while constructing the transformer", e);
    }
View Full Code Here

Examples of javax.xml.transform.stream.StreamSource

         org.xml.sax.SAXException  {

    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = null;
    try {
      transformer = tFactory.newTransformer(new StreamSource(xslDocUri));
//      transformer = tFactory.newTransformer(new StreamSource(new ByteArrayInputStream(xslDoc.getBytes())));
      transformer.transform(
        new StreamSource(new ByteArrayInputStream(xmlDoc)),
        new StreamResult(outputURL));
    }
    catch (Exception e) {
      throw new IOException(e.getMessage());
    }
View Full Code Here

Examples of javax.xml.transform.stream.StreamSource

    ByteArrayOutputStream boutArray = new ByteArrayOutputStream();

    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = null;
    try {
      transformer = tFactory.newTransformer(new StreamSource(xslDocUri));
    }
    catch (Exception e) {
      logger.fatal(e.getMessage(), e);
      throw new IOException(e.getMessage());
    }
    try {
      transformer.transform(
        new StreamSource(iStream),
        new StreamResult(boutArray));
      return boutArray;
    }
    catch (Exception e) {
      logger.fatal(e.getMessage(), e);
View Full Code Here

Examples of javax.xml.transform.stream.StreamSource

        String pkg = (String) dataModel.getValue("package");
        File file = (File) dataModel.getValue("file");

        URL url = this.getClass().getResource(SKELETON_XSL);
        Transformer transformer =
          TransformerFactory.newInstance().newTransformer(new StreamSource(url.openStream()));
        if (pkg.indexOf('.') != -1) {
          transformer.setParameter("package", pkg.substring(0, pkg.lastIndexOf('.')));
          transformer.setParameter("class", pkg.substring(pkg.lastIndexOf(".") + 1, pkg.length()));
        } else {
          transformer.setParameter("package", "");
View Full Code Here

Examples of javax.xml.transform.stream.StreamSource

    }
    long lastMod = oFile.lastModified();

    TransformerFactory oFactory;
    Templates oTemplates;
    StreamSource oStreamSrc;
    SheetEntry oSheet = (SheetEntry) oCache.get(sFilePath);

    if (null!=oSheet) {
      if (DebugFile.trace) {
        DebugFile.writeln("Cache hit: Cached stylesheet date "+new Date(oSheet.lastModified).toString() + " Disk file date "+new Date(lastMod).toString());
      }
      if (lastMod>oSheet.lastModified) {
        oSheet = null;
        oCache.remove(sFilePath);
      }
    } // fi (oSheet)

    if (null==oSheet) {
      if (DebugFile.trace) DebugFile.writeln("TransformerFactory.newInstance()");
      oFactory = TransformerFactory.newInstance();
      if (DebugFile.trace) DebugFile.writeln("new StreamSource("+sFilePath+")");
      oStreamSrc = new StreamSource(sFilePath);
      if (DebugFile.trace) DebugFile.writeln("TransformerFactory.newTemplates(StreamSource)");
      oTemplates = oFactory.newTemplates(oStreamSrc);
      oSheet = new SheetEntry(lastMod, oTemplates);
      if (DebugFile.trace) DebugFile.writeln("WeakHashMap.put("+sFilePath+", SheetEntry)");
      oCache.put(sFilePath, oSheet);
View Full Code Here

Examples of javax.xml.transform.stream.StreamSource

    Transformer oTransformer = StylesheetCache.newTransformer(sStyleSheetPath);

    if (null!=oProps) setParameters(oTransformer, oProps);

    StreamSource oStreamSrcXML = new StreamSource(oXMLInputStream);

    StreamResult oStreamResult = new StreamResult(oOutputStream);

    if (DebugFile.trace) DebugFile.writeln("Transformer.transform(StreamSource,StreamResult)");
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.