Package org.joox

Examples of org.joox.Match


        StreamSource xsl = new StreamSource(isXSL);
        TransformerFactory factory = TransformerFactory.newInstance();
        Transformer transformer = factory.newTransformer(xsl);

        Match manual = $(isXML);
        for (Match section : manual.find("section").each()) {
            Match sections = section.add(section.parents("section")).reverse();

            String path = StringUtils.join(sections.ids(), "/");
            String relativePath = StringUtils.join(Collections.nCopies(sections.size(), ".."), "/") + "/";
            File dir = new File(path);
            dir.mkdirs();

            System.out.println("Transforming section " + path);
            FileOutputStream out = new FileOutputStream(new File(dir, "index.php"));
View Full Code Here


        StreamSource xsl = new StreamSource(isXSL);
        TransformerFactory factory = TransformerFactory.newInstance();
        Transformer transformer = factory.newTransformer(xsl);

        Match manual = $(isXML);

        File dir = new File("manual-single-page");
        dir.mkdirs();

        System.out.println("Transforming manual");
        FileOutputStream out = new FileOutputStream(new File(dir, "index.php"));

        Source source = new DOMSource(manual.document());
        Result target = new StreamResult(out);

        transformer.transform(source, target);

        out.close();
View Full Code Here

        StreamSource xsl = new StreamSource(isXSL);
        TransformerFactory factory = TransformerFactory.newInstance();
        Transformer transformer = factory.newTransformer(xsl);

        Match manual = $(isXML);

        File dir = new File("manual-pdf");
        dir.mkdirs();
        FileOutputStream fout = new FileOutputStream(new File(dir, "jOOQ-manual.fo.xml"));

        Source source = new DOMSource(manual.document());
        Result target = new StreamResult(fout);

        transformer.transform(source, target);
        fout.close();
View Full Code Here

            String docBookHeaderContent = docConverter.convertDocbook(webEngine, allAscContent.toString(), true);
            String docBookChapterContent = docConverter.convertDocbook(webEngine, allAscChapters.toString(), true);

            StringReader bookReader = new StringReader(docBookHeaderContent);
            Match rootDocument = $(new InputSource(bookReader));
            bookReader.close();

            bookReader = new StringReader(docBookChapterContent);
            Match chapterDocument = $(new InputSource(bookReader));
            bookReader.close();

            rootDocument.append(chapterDocument.find("chapter"));

            // changes formalpara to figure bug fix
            rootDocument.find("imageobject").parents("formalpara").each((context) -> {
                $(context).rename("figure");
            });
View Full Code Here

        try {

            String docbook = docConverter.convertDocbookArticle(webEngine);

            StringReader bookReader = new StringReader(docbook);
            Match rootDocument = $(new InputSource(bookReader));
            bookReader.close();

            // changes formalpara to figure bug fix
            rootDocument.find("imageobject").parents("formalpara").each((context) -> {
                $(context).rename("figure");
            });

            // makes figure centering
            rootDocument.find("figure").find("imagedata").attr("align", "center");

            // remove callout's duplicated refs and pick last
            rootDocument.find("callout").forEach(elem -> {
                String arearefs = $(elem).attr("arearefs");
                String[] cos = arearefs.split(" ");
                if (cos.length > 1)
                    $(elem).attr("arearefs", cos[cos.length - 1]);
            });


            builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
            builder.append("\n");
            builder.append("<?asciidoc-toc?>\n");
            builder.append("<?asciidoc-numbered?>\n");
            builder.append(rootDocument.content());


        } catch (Exception ex) {
            logger.error(ex.getMessage(), ex);
        }
View Full Code Here

            StreamSource xmlSource = new StreamSource(currentPath.resolve("book.xml").toFile());
            transformer.transform(xmlSource, new StreamResult());

            Path containerXml = epubTemp.resolve("META-INF/container.xml");

            Match root = $(containerXml.toFile());
            root
                .find("rootfile")
                .attr("full-path", "OEBPS/package.opf");

            StringBuilder builder = new StringBuilder();
            builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

            Match wrapper = $("wrapper");
            wrapper.append(root);
            builder.append(wrapper.content());

            root.write(containerXml.toFile());

            IOHelper.writeToFile(containerXml, builder.toString(), TRUNCATE_EXISTING, WRITE);
View Full Code Here

TOP

Related Classes of org.joox.Match

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.