Package com.lightcrafts.utils.xml

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


                    "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

        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

            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

        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

    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

            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

                    "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

        File file = new File(args[0]);
        ImageInfo info = ImageInfo.getInstanceFor(file);
        ImageMetadata meta = info.getMetadata();
        URL url = getDefaultDocumentUrl(meta);
        if (url != null) {
            XmlDocument doc = DocumentDatabase.getDefaultDocument(meta);
            doc.write(System.out);
        }
        System.out.println(url);
    }
View Full Code Here

    public static XmlDocument getDefaultDocument(ImageMetadata meta) {
        URL url = DefaultDocuments.getDefaultDocumentUrl(meta);
        if (url != null) {
            try {
                InputStream in = url.openStream();
                XmlDocument doc = new XmlDocument(in);
                in.close();
                return doc;
            }
            catch (IOException e) {
                if (DefaultDocuments.Debug) {
View Full Code Here

TOP

Related Classes of com.lightcrafts.utils.xml.XmlDocument

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.