private function parseObject($node)
    {
        // class is required in the schema
        $class = $node->getAttribute('class');

        if (!class_exists($class)) {
            throw new SwatClassNotFoundException(
                "Class '{$class}' is not defined.",
                0,
                $class
            );
        }

        // NOTE: this works because SwatUIObject is abstract
        if (!is_subclass_of($class, 'SwatUIObject')) {
            throw new SwatInvalidClassException(
                "Class '{$class}' is not a a descendant of SwatUIObject and " .
                    'cannot be added to the widget tree.'
            );
        }

        $object = new $class();

        // id is optional in the schema
        if ($node->hasAttribute('id')) {
            $object->id = $node->getAttribute('id');
        }

        return $object;
    }