Package javax.xml.transform.stream

Examples of javax.xml.transform.stream.StreamSource


          * input is an XPath node-set, then the signature application should
          * attempt to convert it to octets (apply Canonical XML]) as described
          * in the Reference Processing Model (section 4.3.3.2).
          */
         Source xmlSource =
            new StreamSource(new ByteArrayInputStream(input.getBytes()));
         Source stylesheet;

         /*
          * This complicated transformation of the stylesheet itself is necessary
          * because of the need to get the pure style sheet. If we simply say
          * Source stylesheet = new DOMSource(this._xsltElement);
          * whereby this._xsltElement is not the rootElement of the Document,
          * this causes problems;
          * so we convert the stylesheet to byte[] and use this as input stream
          */
         {
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            Transformer transformer = tFactory.newTransformer();
            DOMSource source = new DOMSource(_xsltElement);
            StreamResult result = new StreamResult(os);

            transformer.transform(source, result);

            stylesheet =
               new StreamSource(new ByteArrayInputStream(os.toByteArray()));
         }

         Transformer transformer = tFactory.newTransformer(stylesheet);
         if (baos==null) {
               ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
View Full Code Here


     *
     * @see de.netseeker.ejoe.adapter.SerializeAdapter#read(java.io.InputStream)
     */
    public Object read( InputStream in ) throws Exception
    {
        return _transformer.deserialize( new StreamSource( in ) );
    }
View Full Code Here

                                                       OutputStream destOs,
                                                       InputStream templateIs,
                                                       Properties outputProps)
   throws TransformerException, IOException
   {
      StreamSource source = new StreamSource(srcIs);
      StreamResult result = new StreamResult(destOs);
      StreamSource template = new StreamSource(templateIs);

      /*
        Pre-compile the stylesheet. This Templates object may be used
        concurrently across multiple threads. Creating a Templates object
        allows the TransformerFactory to do detailed performance optimization
View Full Code Here

                                                       InputStream templateIs,
                                                       Properties outputProps,
                                                       Properties xslParams)
   throws TransformerException, IOException
   {
      StreamSource source = new StreamSource( srcIs );
      StreamResult result = new StreamResult( destOs );
      StreamSource template = new StreamSource( templateIs );

      Templates templates = transformerFactory.newTemplates( template );

      // set output properties
      Transformer transformer = templates.newTransformer();
View Full Code Here

    allTemplates.addAll(getDefaults());
    List<PrintTemplate> badTemplates = new ArrayList<PrintTemplate>();
    for (PrintTemplate printTemplate : allTemplates) {
      if (printTemplate.getPage() == null) {
        try {
          Object o = unMarshaller.unmarshal(new StreamSource(new StringReader(printTemplate.getPageXml())));
          printTemplate.setPage((PageComponentImpl) o);
        } catch (Exception e) {
          badTemplates.add(printTemplate);
        }
      }
View Full Code Here

                .getResourceAsStream("/entagged/listing/xml/resource/"
                        + transformTarget.getXslFilename());

        TransformerFactory tf = TransformerFactory.newInstance();

        StreamSource source = new StreamSource(xsl);
        Templates templates = tf.newTemplates(source);

        Transformer trf = templates.newTransformer();

        trf.transform(new StreamSource(input), new StreamResult(output));
    }
View Full Code Here

            File dataFile  = new File(args[2])// data
            try {
                InputStream dataStream = new FileInputStream(dataFile);
                InputStream styleStream = new FileInputStream(styleFile);
                // create XSLT Source and Result objects
                Source data = new StreamSource(dataStream);
                Source style = new StreamSource(styleStream);
                Result output = new StreamResult(System.out);
                // create Transformer and perform the tranfomation
                Transformer xslt =  TransformerFactory.newInstance().newTransformer(style);
                xslt.transform(data, output);
            }
View Full Code Here

   * @return the unmarshalled JAXB object
   * @throws JAXBException when an error occurs
   */
  protected javax.xml.bind.Element unmarshal(org.dom4j.Element element)
      throws JAXBException {
    Source source = new StreamSource(new StringReader(element.asXML()));

    return (javax.xml.bind.Element) getUnmarshaller().unmarshal(source);
  }
View Full Code Here

      URL url = getURL(href);

      if(url != null){

        return new StreamSource(url.toString());
      }
     
      throw new TransformerException("Unable to resolve href " + href);
    }
View Full Code Here

    this.uriResolver = uriResolver;
    this.cacheStyleSheet(file);
  }

  private void cacheStyleSheet(File f) throws TransformerConfigurationException{
    Source xsltSource = new StreamSource(f);
    TransformerFactory transFact = TransformerFactory.newInstance();

    if(uriResolver != null){
      transFact.setURIResolver(uriResolver);
    }
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.