Package javax.xml.transform.stream

Examples of javax.xml.transform.stream.StreamSource


            ContentDisposition disp = new ContentDisposition(contentDisposition.get(0));
            if(disp.getParameter("name") != null && disp.getParameter("name").equals(propertyName)){
              if(clazz.isAssignableFrom(DataHandler.class))
                return new DataHandler(new MimePartDataSource(new MimeBodyPart(mimePart.read())));
              else if(clazz.isAssignableFrom(javax.xml.transform.Source.class))
                return new StreamSource(mimePart.read());
            }
          } catch (Exception e) {
            if(this.traceEnabled){
              traceLog.error(String.format("Error while handling attachment name:\"%s\". message: \"%s\"",
                  propertyName,e.getMessage()));
View Full Code Here


  public @WebResult(name="albums") FeedType listAlbums(@WebParam(name = "crediential") Crediential crediential) {
    try {
      //TODO from JNDI property
      URL       albumURL   = new URL("http://picasaweb.google.com/data/feed/api/user/"+crediential.getUsername()+"?kind=album");
      Unmarshaller   um       = context.createUnmarshaller();
      FeedType ob = um.unmarshal(new StreamSource(albumURL.openStream()),FeedType.class).getValue();
      return ob;
    } catch (Exception e) {
      e.printStackTrace();
      throw new Error("Album request failed",e);
    }
View Full Code Here

          @WebParam(name = "albumUrl", partName = "albumUrl")
          String albumUrl) {
    try {
      URL       albumURL   = new URL(albumUrl);
      Unmarshaller   um       = context.createUnmarshaller();
      FeedType ob = um.unmarshal(new StreamSource(albumURL.openStream()),FeedType.class).getValue();
      return ob;
    } catch (Exception e) {
      e.printStackTrace();
      throw new Error("Album request failed",e);
    }
View Full Code Here

  @Override
  public XMLStreamOutput getXmlStream(TestInput arg0) {
    XMLStreamOutput xml = new XMLStreamOutput();
    xml.setOutputFormates("application/xml");
    // File or any source
    xml.setXml(new StreamSource(ChartPortImpl.class.getResourceAsStream("test.xml")));
    return xml;
  }
View Full Code Here

    @Override
    public void transform() throws Exception {
        TransformerFactory factory = TransformerFactory.newInstance();
        FileOutputStream fos = new FileOutputStream(target.toString());
        javax.xml.transform.Transformer transformer =
                              factory.newTransformer(new StreamSource(template.toString()));
        transformer.transform(new StreamSource(source.toString()),
                              new StreamResult(fos));
       
        fos.close();
    }
View Full Code Here

        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

        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

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

        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

    }

    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

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.