Package javax.xml.transform.stream

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


    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

        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

    }
    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

    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

    ByteArrayOutputStream oOutputStream = new ByteArrayOutputStream();
    ByteArrayInputStream oXMLInputStream = new ByteArrayInputStream(sXMLInput.getBytes(sEncoding));
    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)");
    oTransformer.transform(oStreamSrcXML, oStreamResult);
    oStreamSrcXML = null;
    oXMLInputStream.close();
View Full Code Here

    }

    ByteArrayOutputStream oOutputStream = new ByteArrayOutputStream();

    TransformerFactory oFactory = TransformerFactory.newInstance();
    StreamSource oStreamSrc = new StreamSource(oStyleSheetStream);
    Templates oTemplates = oFactory.newTemplates(oStreamSrc);
    Transformer oTransformer = oTemplates.newTransformer();

    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)");
    oTransformer.transform(oStreamSrcXML, oStreamResult);
    oStreamSrcXML = null;
    oXMLInputStream.close();
View Full Code Here

    throws IOException,FOPException,TransformerException,TransformerConfigurationException {
    ByteArrayOutputStream oPdf = new ByteArrayOutputStream();

    String sFO = StylesheetCache.transform (getClass().getResourceAsStream("xhtml2fo.xsl"), sXHTML, null);

    StreamSource oSrc = new StreamSource(new StringReader(sFO));

    SAXResult oRes = new SAXResult(FopFactory.newInstance().newFop(MimeConstants.MIME_PDF, oPdf).getDefaultHandler());

    TransformerFactory.newInstance().newTransformer().transform(oSrc, oRes);
View Full Code Here

  }

  public CatalogBuilder parseIntoBuilder( Reader reader, URI docBaseUri )
          throws ThreddsXmlParserException
  {
    Source source = new StreamSource( reader, docBaseUri.toString() );
    return readCatalogXML( source );
  }
View Full Code Here

  }

  public CatalogBuilder parseIntoBuilder( InputStream is, URI docBaseUri )
          throws ThreddsXmlParserException
  {
    Source source = new StreamSource( is, docBaseUri.toString() );
    return readCatalogXML( source );
  }
View Full Code Here

TOP

Related Classes of javax.xml.transform.stream.StreamSource

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.