Examples of XmlDocument


Examples of com.lightcrafts.utils.xml.XmlDocument

        PrintWriter printer = new PrintWriter(out);
        printer.println("batch name: " + name);
        printer.println("output folder: " + directory.getAbsolutePath());
        printer.println("export options:");
        printer.flush();
        XmlDocument doc = new XmlDocument("Export");
        XmlNode root = doc.getRoot();
        export.write(root);
        try {
            doc.write(out);
        }
        catch (IOException e) {
            e.printStackTrace(printer);
        }
    }
View Full Code Here

Examples of com.lightcrafts.utils.xml.XmlDocument

        String path = directory.getAbsolutePath();
        Prefs.put(DirectoryKey + context, path);

        try {
            XmlDocument doc = new XmlDocument(ExportKey);
            export.write(doc.getRoot());
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            doc.write(out);
            out.close();
            String text = out.toString("UTF-8");
            Prefs.put(ExportKey + context, text);
        }
        catch (IOException e) {
View Full Code Here

Examples of com.lightcrafts.utils.xml.XmlDocument

        if (text != null) {
            try {
                InputStream in = new ByteArrayInputStream(
                    text.getBytes("UTF-8")
                );
                XmlDocument doc = new XmlDocument(in);
                XmlNode root = doc.getRoot();
                export = (ImageFileExportOptions) ImageExportOptions.read(root);
            }
            catch (IOException e) {
                System.err.print(
                    "Error reading BatchConfig preferences: "
View Full Code Here

Examples of com.lightcrafts.utils.xml.XmlDocument

                    "No Template named \"" + key + "\" exists in " +
                    TemplateDir.getAbsolutePath()
                );
            }
            InputStream in = new FileInputStream(file);
            XmlDocument doc = new XmlDocument(in);
            in.close();
            return doc;
        }
        catch (XMLException e) {
            throw new TemplateException(
View Full Code Here

Examples of com.lightcrafts.utils.xml.XmlDocument

        throws TemplateException
    {
        String camera = meta.getCameraMake(true);
        if (camera != null) {
            if (key != null) {
                XmlDocument xml = getTemplateDocument(key);
                TemplateKey defaultKey =
                    new TemplateKey(CameraDefaultNamespace, camera);
                addTemplateDocument(xml, defaultKey, true);
            }
            else {
View Full Code Here

Examples of com.lightcrafts.utils.xml.XmlDocument

            if (camera != null) {
                // A default template is a template with the camera's name
                // in the special namespace:
                TemplateKey key =
                    new TemplateKey(CameraDefaultNamespace, camera);
                XmlDocument xml = null;
                try {
                    xml = getTemplateDocument(key);
                }
                catch (TemplateException e) {
                    // Counts as a missing template.
View Full Code Here

Examples of com.lightcrafts.utils.xml.XmlDocument

        String camera = meta.getCameraMake(true);
        if (camera != null) {
            String name = Prefs.get(camera, null);
            if (name != null) {
                // Make sure the template has not been removed:
                XmlDocument xml = null;
                TemplateKey key = new TemplateKey(CameraDefaultNamespace, name);
                try {
                    xml = getTemplateDocument(key);
                }
                catch (TemplateException e) {
View Full Code Here

Examples of com.lightcrafts.utils.xml.XmlDocument

    private static void migratePrefsTemplates() {
        try {
            List<String> names = getPrefsTemplateNames();
            for (String name : names) {
                try {
                    XmlDocument doc = getPrefsTemplateDocument(name);
                    TemplateKey newKey = new TemplateKey("", name);
                    addTemplateDocument(doc, newKey, false);
                    removePrefsTemplateDocument(name);
                    System.out.println(
                        "Migrated old-style template " + name
View Full Code Here

Examples of com.lightcrafts.utils.xml.XmlDocument

            List<TemplateKey> keys = TemplateDatabase.getTemplateKeys();
            for (TemplateKey key : keys) {
                String namespace = key.getNamespace();
                if (namespace.equals("")) {
                    try {
                        XmlDocument xml = TemplateDatabase.getTemplateDocument(key);
                        String name = key.getName();
                        TemplateKey newKey = new TemplateKey(DefaultNamespace, name);
                        TemplateDatabase.addTemplateDocument(xml, newKey, false);
                        TemplateDatabase.removeTemplateDocument(key);
                    }
View Full Code Here

Examples of com.lightcrafts.utils.xml.XmlDocument

                    "No template named \"" + name + "\""
                );
            }
            byte[] bytes = text.getBytes();
            InputStream in = new ByteArrayInputStream(bytes);
            XmlDocument doc = new XmlDocument(in);
            return doc;
        }
        catch (IOException e) {
            throw new TemplateException(
                "Couldn't access template \"" + name + "\"", e
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.