Package javax.xml.transform.stream

Examples of javax.xml.transform.stream.StreamSource


    */
   private static Transformer newTransformer(String systemId, String xslString, URIResolver uriResolver, Map props) throws Exception {
      TransformerFactory transformerFactory = TransformerFactory.newInstance();
      if (uriResolver != null)
         transformerFactory.setURIResolver(uriResolver);
      StreamSource xslStreamSource = null;
      if(systemId != null)
          xslStreamSource = new StreamSource(new StringReader(xslString), systemId);
      else
          xslStreamSource = new StreamSource(new StringReader(xslString));

      Transformer transformer = transformerFactory.newTransformer(xslStreamSource);
      if(props != null) {
          Iterator iter = props.entrySet().iterator();
          while(iter.hasNext()) {
View Full Code Here


      if (this.transformer == null) {
         return xmlLiteral;
      }
      else {
         try {
            StreamSource xmlStreamSource = new StreamSource(new StringReader(xmlLiteral));
            StringWriter stringWriter = new StringWriter();
            StreamResult resultStream = new StreamResult(stringWriter);
            this.transformer.transform(xmlStreamSource, resultStream);
            return stringWriter.toString();
         }
View Full Code Here

        } else {
            throw new JSDOMProviderException(ILLEGAL_INVOKE_TYPE);
        }
        Endpoint ep = Endpoint.create(binding, this);
        List<Source> metadata = new ArrayList<Source>();
        metadata.add(new StreamSource(wsdlLoc));
        ep.setMetadata(metadata);
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(Endpoint.WSDL_SERVICE, new QName(tgtNmspc, svcNm));
        props.put(Endpoint.WSDL_PORT, new QName(tgtNmspc, portNm));
        ep.setProperties(props);
View Full Code Here

        return (Element)doc.getDocumentElement().getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "usage")
            .item(0);
    }

    public void transform(InputStream stylesheet, OutputStream out) throws TransformerException {
        Transformer trans = TransformerFactory.newInstance().newTransformer(new StreamSource(stylesheet));
        trans.transform(new DOMSource(doc), new StreamResult(out));
    }
View Full Code Here

        // output the result document
        if (LOG.isLoggable(Level.FINE)) {
            try {
                Transformer serializer = TransformerFactory.newInstance()
                    .newTransformer(
                                    new StreamSource(Tool.class
                                        .getResourceAsStream("indent-no-xml-declaration.xsl")));

                serializer.transform(new DOMSource(resultDoc), new StreamResult(new PrintStream(System.out)));
            } catch (Exception ex) {
                LOG.log(Level.SEVERE, "ERROR_SERIALIZE_COMMAND_MSG", ex);
View Full Code Here

        }
        return metadataValidator;
    }

    private Schema getSchema(InputStream is) {
        Source schemaFile = new StreamSource(is);

        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
        Schema schema = null;
        try {
            schema = factory.newSchema(schemaFile);
View Full Code Here

   
    public void setValidating(boolean validate) {
        if (validate) {
            this.schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
            try {
                this.schema = schemaFactory.newSchema(new StreamSource(getSchemaLocation()));
            } catch (org.xml.sax.SAXException e) {
                LOG.log(Level.SEVERE, "SCHEMA_FACTORY_EXCEPTION_MSG");
            }
            this.parserFactory.setSchema(this.schema);
        }
View Full Code Here

    public void setValidating(boolean validate) {
        if (validate) {
            this.schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
            try {
                this.schema = schemaFactory.newSchema(new StreamSource(getSchemaLocation()));
            } catch (org.xml.sax.SAXException e) {
                LOG.log(Level.SEVERE, "SCHEMA_FACTORY_EXCEPTION_MSG");
            }
            this.parserFactory.setSchema(this.schema);
        }
View Full Code Here

    public void testSetMetaData() throws Exception {
        EndpointReferenceType ref = new EndpointReferenceType();
        List<Source> metadata = new ArrayList<Source>();
        //Read a Schema File
        InputStream isXsd =  getClass().getResourceAsStream("resources/addressing.xsd");
        StreamSource ssXsd = new StreamSource(isXsd);
        metadata.add(ssXsd);
       
        //Read a WSDL File
        InputStream isWSDL =  getClass().getResourceAsStream("resources/hello_world.wsdl");
        StreamSource ssWSDL = new StreamSource(isWSDL);
        metadata.add(ssWSDL);
       
        EndpointReferenceUtils.setMetadata(ref, metadata);
        assertNotNull("MetaData should not be empty", ref.getMetadata());
        List<Object> anyList = ref.getMetadata().getAny();
View Full Code Here

   
    public void testStreamSourceRead() throws Exception {
        TestDynamicDataBindingCallback callback = 
            new TestDynamicDataBindingCallback(StreamSource.class, Mode.PAYLOAD);       
        SOAPBodyDataReader<SOAPBody> soapBodyDataReader = new SOAPBodyDataReader<SOAPBody>(callback);
        StreamSource obj = (StreamSource)soapBodyDataReader.read(0, soapMsg.getSOAPBody());
        assertNotNull(obj);
        checkSource("TestSOAPInputMessage", obj);       
    }
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.