A
A
Avery0072014-11-13 15:43:19
Java
Avery007, 2014-11-13 15:43:19

What are the java libraries for converting fb2 to html?

What are the java libraries for converting fb2 to html?
PS The more built-in formats for converting to html, the better.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Keyn Din, 2014-11-13
@Avery007

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);
        }
    }
}

taken from official tutorial

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question