Examples of StreamSource


Examples of javax.xml.transform.stream.StreamSource

    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

Examples of javax.xml.transform.stream.StreamSource

    }

    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

Examples of javax.xml.transform.stream.StreamSource

    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

Examples of javax.xml.transform.stream.StreamSource

  }

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

Examples of javax.xml.transform.stream.StreamSource

  }

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

Examples of javax.xml.transform.stream.StreamSource

        SOAPService service = new SOAPService(wsdl, serviceName);
        assertNotNull(service);

        InputStream is =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml");
        StreamSource streamSourceReq = new StreamSource(is);
        assertNotNull(streamSourceReq);
       
        InputStream is1 =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq1.xml");
        StreamSource streamSourceReq1 = new StreamSource(is1);
        assertNotNull(streamSourceReq1);
       
        InputStream is2 =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq2.xml");
        StreamSource streamSourceReq2 = new StreamSource(is2);
        assertNotNull(streamSourceReq2);
       
        InputStream is3 =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq3.xml");
        StreamSource streamSourceReq3 = new StreamSource(is3);
        assertNotNull(streamSourceReq3);
       
       
   

        Dispatch<StreamSource> disp = service.createDispatch(portName,
                                                            StreamSource.class, Service.Mode.MESSAGE);
        StreamSource streamSourceResp = disp.invoke(streamSourceReq);
        assertNotNull(streamSourceResp);
        String expected = "Hello TestSOAPInputMessage";
        checkStreamSource(expected, streamSourceResp);
       
        disp.invokeOneWay(streamSourceReq1);
       
        Response response = disp.invokeAsync(streamSourceReq2);
        StreamSource streamSourceResp2 = (StreamSource)response.get();
        assertNotNull(streamSourceResp2);
        String expected2 = "Hello TestSOAPInputMessage2";
        checkStreamSource(expected2, streamSourceResp2);
       
       
        TestStreamSourceHandler tssh = new TestStreamSourceHandler();
        Future fd = disp.invokeAsync(streamSourceReq3, tssh);
        assertNotNull(fd);
        while (!fd.isDone()) {
            //wait
        }
        String expected3 = "Hello TestSOAPInputMessage3";
        StreamSource streamSourceResp3 = tssh.getStreamSource();
        assertNotNull(streamSourceResp3);
        checkStreamSource(expected3, streamSourceResp3);

    }
View Full Code Here

Examples of javax.xml.transform.stream.StreamSource

        SOAPService service = new SOAPService(wsdl, serviceName);
        assertNotNull(service);

        InputStream is =  getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq.xml");
        StreamSource streamSourceReq = new StreamSource(is);
        assertNotNull(streamSourceReq);
       
        InputStream is1 =  getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq1.xml");
        StreamSource streamSourceReq1 = new StreamSource(is1);
        assertNotNull(streamSourceReq1);
       
        InputStream is2 =  getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq2.xml");
        StreamSource streamSourceReq2 = new StreamSource(is2);
        assertNotNull(streamSourceReq2);
       
        InputStream is3 =  getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq3.xml");
        StreamSource streamSourceReq3 = new StreamSource(is3);
        assertNotNull(streamSourceReq3);

        Dispatch<StreamSource> disp = service.createDispatch(portName,
                                                            StreamSource.class, Service.Mode.PAYLOAD);
        StreamSource streamSourceResp = disp.invoke(streamSourceReq);
        assertNotNull(streamSourceResp);
        String expected = "Hello TestSOAPInputMessage";
        checkStreamSource(expected, streamSourceResp);
       
        disp.invokeOneWay(streamSourceReq1);
       
        Response response = disp.invokeAsync(streamSourceReq2);
        StreamSource streamSourceResp2 = (StreamSource)response.get();
        assertNotNull(streamSourceResp2);
        String expected2 = "Hello TestSOAPInputMessage2";
        checkStreamSource(expected2, streamSourceResp2);
       
       
        TestStreamSourceHandler tssh = new TestStreamSourceHandler();
        Future fd = disp.invokeAsync(streamSourceReq3, tssh);
        assertNotNull(fd);
        while (!fd.isDone()) {
            //wait
        }
        String expected3 = "Hello TestSOAPInputMessage3";
        StreamSource streamSourceResp3 = tssh.getStreamSource();
        assertNotNull(streamSourceResp3);
        checkStreamSource(expected3, streamSourceResp3);

    }
View Full Code Here

Examples of javax.xml.transform.stream.StreamSource

        if (aXmlInput instanceof Node) {
            // aXmlInput is a DOM object
            tXmlSource = new DOMSource((Node)aXmlInput);
        } else if (aXmlInput instanceof InputStream) {
            // aXmlInput is a InputStream (XML byte stream)
            tXmlSource = new StreamSource((InputStream)aXmlInput);
        } else if (aXmlInput instanceof Reader) {
            // aXmlInput is a Reader (XML character stream)
            tXmlSource = new StreamSource((Reader)aXmlInput);
        } else if (aXmlInput instanceof String) {
            // aXmlInput is an URL (conforming to the URI syntax)
            tXmlSource = new StreamSource((String)aXmlInput);
        } else {
            throw new IllegalArgumentException("HTMLwithXSLBuilder2::transform : Illegal argument for XML input");
        }

        if (aXslInput instanceof Node) {
            tXslSource = new DOMSource((Node)aXslInput);
        } else if (aXslInput instanceof InputStream) {
            tXslSource = new StreamSource((InputStream)aXslInput);
        } else if (aXslInput instanceof Reader) {
            tXslSource = new StreamSource((Reader)aXslInput);
        } else if (aXslInput instanceof String) {
            tXslSource = new StreamSource((String)aXslInput);
        } else {
            throw new IllegalArgumentException("HTMLwithXSLBuilder2::transform : Illegal argument for XSL input");
        }

        if (aHtmlOutput instanceof Node) {
View Full Code Here

Examples of javax.xml.transform.stream.StreamSource

      {
        XMLHelper.setTransformerProperties();

        TransformerFactory tFactory = TransformerFactory.newInstance();
        transformer = tFactory
            .newTransformer(new StreamSource(xslFile));
        mTransformers.put(Thread.currentThread().getName() + xslFile,
            transformer);
      }
    }
    catch (TransformerConfigurationException e)
View Full Code Here

Examples of javax.xml.transform.stream.StreamSource

  protected String transformXML(String xmlOld, String xslFile, Message message)
      throws XException
  {
    String xmlNew = null;
    StringReader source = new StringReader(xmlOld);
    StreamSource streamSource = new StreamSource(source);
    StringWriter result = new StringWriter();
    StreamResult streamResult = new StreamResult(result);

    try
    {
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.