Project

Profile

Help

Support #4737

closed

Support for thread safe XSLT 3 transformation in Saxon-HE

Added by Juhi Gupta over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Multithreading
Sprint/Milestone:
-
Start date:
2020-09-15
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

Currently I am using Saxon-HE, downloading the dependency from maven repository

<!-- https://mvnrepository.com/artifact/net.sf.saxon/Saxon-HE -->
<dependency>
	<groupId>net.sf.saxon</groupId>
	<artifactId>Saxon-HE</artifactId>
	<version>10.1</version>
</dependency>  

I have a function which performs transformation xml to json using XSLT 3 support in Saxon-HE,

String xmltransformationusingSaxon(String transformationMapping, String data){
        TransformerFactory factory = new TransformerFactoryImpl();
        Transformer transformer = factory.newTransformer(new StreamSource(new StringReader(transformationMapping)));
        transformer.transform(new StreamSource(new StringReader(data)), new StreamResult(writer));
        output = writer.toString();
		return output;
}

I have observed there is a performance hit when we create TransformerFactory for each thread request, If it was thread safe, we can make it static and all the threads should be able to access it without causing an issue.

or if you can suggest any other option to increase the performance of the parser or achieve the requirement in any other way, since it is quite slow now.

Please register to edit this issue

Also available in: Atom PDF