Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to stream-based loading #11479

Merged
merged 16 commits into from
Jul 17, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;

import org.jabref.architecture.AllowedToUseClassGetResource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@AllowedToUseClassGetResource("to determine the root directory")
public class MathMLParser {
private static final Logger LOGGER = LoggerFactory.getLogger(MathMLParser.class);
private static final String XSLT_FILE_PATH = "/xslt/mathml_latex/mmltex.xsl";
Expand All @@ -38,7 +41,7 @@ public static String parse(XMLStreamReader reader) {
Source xmlSource = new StreamSource(new StringReader(xmlContent));

// No SystemId required, because no relative URLs need to be resolved
Source xsltSource = new StreamSource(xsltResource);
Source xsltSource = new StreamSource(xsltResource, MathMLParser.class.getResource(XSLT_FILE_PATH).toExternalForm());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK for a workaround. - Can we do add a fake path here? Maybe, #future work


TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer(xsltSource);
Expand Down
Loading