func (c *XMLConfigContainer) DefaultBool(key string, defaultval bool) bool {
	if v, err := c.Bool(key); err != nil {
		return defaultval
	} else {
		return v
	}
}
DefaultBool return the bool value if has no error
otherwise return the defaultval
package xml
import (
	"encoding/xml"
	"errors"
	"fmt"
	"io/ioutil"
	"os"
	"path"
	"strconv"
	"strings"
	"sync"
	"time"
	"github.com/astaxie/beego/config"
	"github.com/beego/x2j"
)
type XMLConfig struct{}
func (xc *XMLConfig) Parse(filename string) (config.ConfigContainer, error) {
	file, err := os.Open(filename)
	if err != nil {
		return nil, err
	}
	defer file.Close()
	x := &XMLConfigContainer{data: make(map[string]interface{})}
	content, err := ioutil.ReadAll(file)
	if err != nil {
		return nil, err
	}
	d, err := x2j.DocToMap(string(content))
	if err != nil {
		return nil, err
	}
	x.data = d["config"].(map[string]interface{})
	return x, nil
}
func (x *XMLConfig) ParseData(data []byte) (config.ConfigContainer, error) {
	tmpName := path.Join(os.TempDir(), "beego", fmt.Sprintf("%d", time.Now().Nanosecond()))
	os.MkdirAll(path.Dir(tmpName), os.ModePerm)
	if err := ioutil.WriteFile(tmpName, data, 0655); err != nil {
		return nil, err
	}
	return x.Parse(tmpName)
}
type XMLConfigContainer struct {
	data map[string]interface{}
	sync.Mutex
}
func (c *XMLConfigContainer) Bool(key string) (bool, error) {
	return strconv.ParseBool(c.data[key].(string))
}