Package com.joshondesign.xml

Examples of com.joshondesign.xml.Doc.xpath()


    private List<File> loadRecentDocs(File file) {
        List<File> files = new ArrayList<File>();
        if(file.exists()) {
            try {
                Doc doc = XMLParser.parse(file);
                for(Elem e : doc.xpath("//file")) {
                    File f = new File(e.attr("filepath"));
                    //files.add(new File(e.attr("filepath")));
                    if(f.exists()) {
                        files.add(f);
                    }
View Full Code Here


        rect.setFillPaint(grad);
        rect.setStrokeWidth(0);
        page.clear();
        page.add(rect);
        Doc xdoc = saveAndReadback(doc);
        Elem e = xdoc.xpath("/svg/linearGradient/stop").iterator().next();
        assertTrue("0.0".equals(e.attr("offset")));
    }
    @Test public void testLinearGradientRect() throws Exception {
        MultiGradientFill grad = new LinearGradientFill()
                .setStartX(0).setEndX(100)
View Full Code Here

        rect.setFillPaint(grad);
        rect.setStrokeWidth(0);
        page.clear();
        page.add(rect);
        Doc xdoc = saveAndReadback(doc);
        Iterator<? extends Elem> it = xdoc.xpath("/svg/linearGradient/stop").iterator();
        it.next();
        Elem e = it.next();
        assertTrue("0.5".equals(e.attr("offset")));
    }
View Full Code Here

        if(version < NativeExport.CURRENT_VERSION) {
            doc = upgradeDocument(doc);
        }
        loadNumberAttribute(doc.xpathElement("/sketchy/info"),sdoc,"width");
        loadNumberAttribute(doc.xpathElement("/sketchy/info"),sdoc,"height");
        for(Elem e : doc.xpath("/sketchy/page")) {
            loadPage(sdoc,e,zipFile);
        }
        String type = doc.xpathString("/sketchy/info/@type");
        if("presentation".equals(type)) {
            sdoc.setPresentation(true);
View Full Code Here

    public static List<SNode> loadShapes(File file, ZipFile zipFile) throws Exception {
        Doc doc = XMLParser.parse(new FileInputStream(file));
        doc.setBaseURI(file.toURI());
        List<SNode> shapes = new ArrayList<SNode>();
        for(Elem e : doc.xpath("/sketchy/*")) {
            shapes.add(loadAnyShape(e,zipFile));
        }
        return shapes;
    }

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.