public double getUserBalance(String uid) {
        Node userNode = getUserNode(uid);
        if (userNode != null) {
            NamedNodeMap attr = userNode.getAttributes();
            Node nodeAttr = attr.getNamedItem("balance");
            return Double.parseDouble(nodeAttr.getTextContent());
        } else {
            return 0;
        }
    }