semi implemented
This commit is contained in:
@@ -31,9 +31,8 @@ public class Saxon implements XmlEngine{
|
|||||||
Processor processor = new Processor(false);
|
Processor processor = new Processor(false);
|
||||||
|
|
||||||
XsltCompiler compiler = processor.newXsltCompiler();
|
XsltCompiler compiler = processor.newXsltCompiler();
|
||||||
XsltExecutable stylesheet = compiler.compile(new StreamSource( new StringReader(transform) ));
|
|
||||||
String filesPath = "/tmp/"+UUID.randomUUID()+"/";
|
String filesPath = "/tmp/"+UUID.randomUUID()+"/";
|
||||||
ArrayList<String> xmlFilesUri = new ArrayList<>();
|
|
||||||
try{
|
try{
|
||||||
Path processPath = Paths.get(filesPath);
|
Path processPath = Paths.get(filesPath);
|
||||||
Files.createDirectories(processPath);
|
Files.createDirectories(processPath);
|
||||||
@@ -42,23 +41,20 @@ public class Saxon implements XmlEngine{
|
|||||||
Path filePath = Files.createFile( Paths.get(filesPath + fileData.getFilename() ) );
|
Path filePath = Files.createFile( Paths.get(filesPath + fileData.getFilename() ) );
|
||||||
try (FileWriter writer = new FileWriter(filePath.toFile())) {
|
try (FileWriter writer = new FileWriter(filePath.toFile())) {
|
||||||
writer.write(fileData.getData());
|
writer.write(fileData.getData());
|
||||||
xmlFilesUri.add(filesPath + fileData.getFilename());
|
transform = transform.replace('\''+fileData.getFilename()+'\'',filesPath+fileData.getFilename());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
XsltExecutable stylesheet = compiler.compile(new StreamSource( new StringReader(transform) ));
|
||||||
|
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
Serializer out = processor.newSerializer(sw);
|
Serializer out = processor.newSerializer(sw);
|
||||||
out.setOutputProperty(Serializer.Property.METHOD, "xml");
|
out.setOutputProperty(Serializer.Property.METHOD, "xml");
|
||||||
out.setOutputProperty(Serializer.Property.INDENT, "yes");
|
out.setOutputProperty(Serializer.Property.INDENT, "yes");
|
||||||
Xslt30Transformer transformer = stylesheet.load30();
|
Xslt30Transformer transformer = stylesheet.load30();
|
||||||
transformer.setResourceResolver( );
|
|
||||||
processor.setCatalogFiles(xmlFilesUri.toArray(new String[0]));
|
|
||||||
transformer.transform( new StreamSource( new File(filesPath+data[0].getFilename()) ) , out );
|
transformer.transform( new StreamSource( new File(filesPath+data[0].getFilename()) ) , out );
|
||||||
return sw.toString();
|
return sw.toString();
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
Thread.sleep(1000000);
|
|
||||||
Files
|
Files
|
||||||
.walk( Paths.get(filesPath) )
|
.walk( Paths.get(filesPath) )
|
||||||
.sorted(Comparator.reverseOrder())
|
.sorted(Comparator.reverseOrder())
|
||||||
|
|||||||
Reference in New Issue
Block a user