Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
I think you shouldn't put java on the way from fb2 to html, but it's better to do it by means of xslt transformations.
+ no libraries needed, everything is in the standard library
+ minimum required code
+ separation of code from formatting
+ replacement of the template "on the fly", without recompilation
+ many ready-made xslt-templates for this task, incl. and offsite.
+ the transformation language is the most logical for this task
- the transformations themselves are resource-intensive, not suitable for generating html in real time
- most likely, you will have to learn this markup language minimally.
related links
:
Any2FB2
fb22htmls.xsl
// ...
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
// ...
public class Stylizer {
// ...
public static void main (String argv[]) {
// ...
try {
File stylesheet = new File(argv[0]);
File datafile = new File(argv[1]);
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse(datafile);
// ...
StreamSource stylesource = new StreamSource(stylesheet);
Transformer transformer = Factory.newTransformer(stylesource);
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question