Package javax.xml.transform.stream

Examples of javax.xml.transform.stream.StreamSource


            try {
                for (Source source : metadata) {
                    Node node = null;
                    boolean doTransform = true;
                    if (source instanceof StreamSource) {
                        StreamSource ss = (StreamSource)source;
                        if (null == ss.getInputStream()
                            && null == ss.getReader()) {
                            setWSDLLocation(ref, ss.getSystemId());
                            doTransform = false;
                        }
                    } else if (source instanceof DOMSource) {
                        node = ((DOMSource)node).getNode();
                        doTransform = false;
View Full Code Here


        is2 =  getClass().getResourceAsStream("GreetMeDocLiteralReq.xml");
        is3 =  getClass().getResourceAsStream("GreetMeDocLiteralReq.xml");
        SOAPMessage msg = MessageFactory.newInstance().createMessage(null, is);
        domSource = new DOMSource(msg.getSOAPPart());
        saxSource = new SAXSource(new InputSource(is2));
        streamSource = new StreamSource(is3);
        soapMsg = MessageFactory.newInstance().createMessage();
        assertNotNull(soapMsg);
    }
View Full Code Here

    public void testStreamSourceRead() throws Exception {
        TestDynamicDataBindingCallback callback = 
            new TestDynamicDataBindingCallback(StreamSource.class, Mode.MESSAGE);       
        SOAPMessageDataReader<SOAPMessage> soapMessageDataReader =
            new SOAPMessageDataReader<SOAPMessage>(callback);
        StreamSource obj = (StreamSource)soapMessageDataReader.read(0, soapMsg);
        assertNotNull(obj);
        checkSource("TestSOAPInputMessage", obj);       
    }
View Full Code Here

            ex.printStackTrace();
        }
    }

    public StreamSource invoke(StreamSource request) {
        StreamSource response = new StreamSource();
        try {
            SOAPMessage msg = factory.createMessage();
            msg.getSOAPPart().setContent(request);
            SOAPBody body = msg.getSOAPBody();
            Node n = body.getFirstChild();

            while (n.getNodeType() != Node.ELEMENT_NODE) {
                n = n.getNextSibling();
            }
            if (n.getLocalName().equals(sayHi.getLocalPart())) {
                response.setInputStream(sayHiInputStream);
            } else if (n.getLocalName().equals(greetMe.getLocalPart())) {
                response.setInputStream(greetMeInputStream);
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return response;
View Full Code Here

            ex.printStackTrace();
        }
    }

    public StreamSource invoke(StreamSource request) {
        StreamSource response = new StreamSource();
        try {
            DOMResult domResult = new DOMResult();
            Transformer transformer = TransformerFactory.newInstance().newTransformer();
            transformer.transform(request, domResult);
            Node n = domResult.getNode().getFirstChild();

            while (n.getNodeType() != Node.ELEMENT_NODE) {
                n = n.getNextSibling();
            }
            if (n.getLocalName().equals(sayHi.getLocalPart())) {
                response.setInputStream(sayHiInputStream);
            } else if (n.getLocalName().equals(greetMe.getLocalPart())) {
                response.setInputStream(greetMeInputStream);
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return response;
View Full Code Here

        is2 =  getClass().getResourceAsStream("GreetMeDocLiteralSOAPBodyReq.xml");
        is3 =  getClass().getResourceAsStream("GreetMeDocLiteralSOAPBodyReq.xml");
        SOAPMessage msg = MessageFactory.newInstance().createMessage(null, is);
        domSource = new DOMSource(msg.getSOAPBody().extractContentAsDocument());
        saxSource = new SAXSource(new InputSource(is2));
        streamSource = new StreamSource(is3);
        soapMsg = MessageFactory.newInstance().createMessage();
        assertNotNull(soapMsg);
    }
View Full Code Here

            if ( xslstream == null )
            {
                throw new PortletException( "No XSL" );
            }

            StreamSource xsl = new StreamSource( xslstream );

            /* XML */
            xmlstream = openXmlInputStream( request );
            if ( xslstream == null )
            {
                throw new PortletException( "No XML" );
            }

            StreamSource xml = new StreamSource( xmlstream );

            /* Transform */
            StreamResult output = new StreamResult( response.getWriter(  ) );
            Transformer  transformer = factory.newTransformer( xsl );
            Map          params = getXslParameters( request, response );
View Full Code Here

    catch ( IOException e )
    {
      throw new ThreddsXmlParserException( "Problem accessing resource [" + documentUri.toString() + "].", e );
    }

    return new StreamSource( is, documentUri.toString() );
  }
View Full Code Here

  {
    if ( file == null )
      throw new IllegalArgumentException( "File may not be null." );
    Source source = null;
    if ( docBaseUri == null )
      source = new StreamSource( file );
    else
    {
      InputStream is = null;
      try
      {
        is = new FileInputStream( file );
      }
      catch ( FileNotFoundException e )
      {
        String message = "Couldn't find file [" + file.getPath() + "].";
        log.error( "parseIntoBuilder(): " + message, e );
        throw new ThreddsXmlParserException( message, e );
      }
      source = new StreamSource( is, docBaseUri.toString() );
    }

    return source;
  }
View Full Code Here

    if (null == source)
    {
      String uri = SystemIDResolver.getAbsoluteURI(urlString, base);

      source = new StreamSource(uri);
    }

    return 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.