public function getConfigValue($name, $default = null, $domain = null)
    {
        if ($domain === null) {
            $domain = $this->getDomain();
        } else if ($domain === false) {
            $domain = '__default__';
        }

        $domain = strtolower($domain);

        if (isset($this->values[$domain]) && array_key_exists($name, $this->values[$domain])) {
            return $this->values[$domain][$name];
        }

        // already tried to fetch this property without success
        if (isset($this->undefined[$domain][$name])) {
            return $default;
        }

        // Find the matching node
        $xpathName = $this->xpathQuote($name);
        if ($domain == '__default__') {
            $node = $this->getNode("./property[@name = $xpathName and not(@domain)]");
        } else {
            $xpathDomain = $this->xpathQuote($domain);
            $node = $this->getNode("./property[@name = $xpathName and @domain = $xpathDomain]");

            if (!$node instanceof xml\SimpleXmlElement) {
                $node = $this->getNode("./property[@name = $xpathName and not(@domain)]");
            }
        }

        // node was not found?
        if (!$node instanceof xml\SimpleXmlElement) {
            $this->undefined[$domain][$name] = true;
            return $default;
        }

        // extract the node value by type
        $type = (string)$node['type'];
        switch ($type) {
            case 'array':
            case 'instance':
                $value = $node->toPhpValue($type);
                break;

            case '':
                $type = 'string';
                // break intentionally omitted

            default:
                $value = $node->toValue($type, 'value');
                break;
        }

        $this->values[$domain][$name] = $value;
        return $value;
    }