Parse UUID from XML Text Content - Android XML

Android examples for XML:XML Node

Description

Parse UUID from XML Text Content

Demo Code


import java.util.UUID;
import java.util.logging.Level;
import org.w3c.dom.Element;

public class Main{
    public static UUID ParseUUID(Element e) {
        UUID uuid = null;/*w  w  w .j a  va  2s.  com*/
        try {
            uuid = UUID.fromString(e.getTextContent().trim());
        } catch (IllegalArgumentException ex) {
            Log.log("Preferences.loadXMLFile(): An Exception occured while parsing the uuid '"
                    + e.getNodeName()
                    + "'. value="
                    + e.getTextContent().trim(), Level.INFO);
        }
        return uuid;
    }
}

Related Tutorials