Java XML Transform Usage castResultToSource(StreamResult result)

Here you can find the source of castResultToSource(StreamResult result)

Description

cast Result To Source

License

Open Source License

Declaration

public static StreamSource castResultToSource(StreamResult result) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;

import java.io.StringReader;

import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;

public class Main {
    public static StreamSource castResultToSource(StreamResult result) {
        StreamSource ss = new StreamSource(new StringReader(result.getWriter().toString()));
        String systemId = result.getSystemId();
        if (systemId != null) {
            ss.setSystemId(new File(systemId));
        }//from w w  w. j  a  va 2  s  .  c o  m
        return ss;
    }
}

Related

  1. bytesToXml(final byte[] body)
  2. closeSource(final Source source)
  3. compareSource(Source src, Source target)
  4. compareStreamSource(StreamSource src1, StreamSource src2)
  5. convert(final Element element)