Resolve bad import

This commit is contained in:
James Agnew 2018-09-30 07:07:19 -04:00
parent 62d6771814
commit f136e1c527
1 changed files with 1060 additions and 1126 deletions

View File

@ -56,9 +56,6 @@ import javax.xml.transform.stream.StreamSource;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.utilities.Utilities.FileVisitor;
import net.sf.saxon.TransformerFactoryImpl;
public class Utilities { public class Utilities {
@ -324,36 +321,6 @@ public class Utilities {
} }
public static byte[] saxonTransform(Map<String, byte[]> files, byte[] source, byte[] xslt) throws TransformerException {
TransformerFactory f = new net.sf.saxon.TransformerFactoryImpl();
f.setAttribute("http://saxon.sf.net/feature/version-warning", Boolean.FALSE);
StreamSource xsrc = new StreamSource(new ByteArrayInputStream(xslt));
f.setURIResolver(new ZipURIResolver(files));
Transformer t = f.newTransformer(xsrc);
t.setURIResolver(new ZipURIResolver(files));
StreamSource src = new StreamSource(new ByteArrayInputStream(source));
ByteArrayOutputStream out = new ByteArrayOutputStream();
StreamResult res = new StreamResult(out);
t.transform(src, res);
return out.toByteArray();
}
public static byte[] transform(Map<String, byte[]> files, byte[] source, byte[] xslt) throws TransformerException {
TransformerFactory f = TransformerFactory.newInstance();
f.setAttribute("http://saxon.sf.net/feature/version-warning", Boolean.FALSE);
StreamSource xsrc = new StreamSource(new ByteArrayInputStream(xslt));
f.setURIResolver(new ZipURIResolver(files));
Transformer t = f.newTransformer(xsrc);
t.setURIResolver(new ZipURIResolver(files));
StreamSource src = new StreamSource(new ByteArrayInputStream(source));
ByteArrayOutputStream out = new ByteArrayOutputStream();
StreamResult res = new StreamResult(out);
t.transform(src, res);
return out.toByteArray();
}
public static void bytesToFile(byte[] content, String filename) throws IOException { public static void bytesToFile(byte[] content, String filename) throws IOException {
FileOutputStream out = new FileOutputStream(filename); FileOutputStream out = new FileOutputStream(filename);
out.write(content); out.write(content);
@ -361,39 +328,6 @@ public class Utilities {
} }
public static String saxonTransform(String source, String xslt) throws TransformerException, FileNotFoundException {
TransformerFactoryImpl f = new net.sf.saxon.TransformerFactoryImpl();
f.setAttribute("http://saxon.sf.net/feature/version-warning", Boolean.FALSE);
StreamSource xsrc = new StreamSource(new FileInputStream(xslt));
Transformer t = f.newTransformer(xsrc);
StreamSource src = new StreamSource(new FileInputStream(source));
StreamResult res = new StreamResult(new ByteArrayOutputStream());
t.transform(src, res);
return res.getOutputStream().toString();
}
public static void saxonTransform(String xsltDir, String source, String xslt, String dest, URIResolver alt) throws FileNotFoundException, TransformerException {
saxonTransform(xsltDir, source, xslt, dest, alt, null);
}
public static void saxonTransform(String xsltDir, String source, String xslt, String dest, URIResolver alt, Map<String, String> params) throws FileNotFoundException, TransformerException {
TransformerFactoryImpl f = new net.sf.saxon.TransformerFactoryImpl();
f.setAttribute("http://saxon.sf.net/feature/version-warning", Boolean.FALSE);
StreamSource xsrc = new StreamSource(new FileInputStream(xslt));
f.setURIResolver(new MyURIResolver(xsltDir, alt));
Transformer t = f.newTransformer(xsrc);
if (params != null) {
for (Map.Entry<String, String> entry : params.entrySet()) {
t.setParameter(entry.getKey(), entry.getValue());
}
}
t.setURIResolver(new MyURIResolver(xsltDir, alt));
StreamSource src = new StreamSource(new FileInputStream(source));
StreamResult res = new StreamResult(new FileOutputStream(dest));
t.transform(src, res);
}
public static void transform(String xsltDir, String source, String xslt, String dest, URIResolver alt) throws FileNotFoundException, TransformerException { public static void transform(String xsltDir, String source, String xslt, String dest, URIResolver alt) throws FileNotFoundException, TransformerException {
TransformerFactory f = TransformerFactory.newInstance(); TransformerFactory f = TransformerFactory.newInstance();