private function parseUI($node, SwatUIObject $parent)
    {
        array_push($this->stack, $parent);

        foreach ($node->childNodes as $child_node) {
            // only parse element nodes. ignore text nodes
            if ($child_node->nodeType == XML_ELEMENT_NODE) {
                if ($child_node->nodeName === 'property') {
                    $this->parseProperty($child_node, $parent);
                } else {
                    $parsed_object = $this->parseObject($child_node);

                    $this->checkParsedObject(
                        $parsed_object,
                        $child_node->nodeName
                    );

                    /*
                     * No exceptions were thrown and the widget has an id
                     * so add to widget list to make it look-up-able.
                     */
                    if (
                        $child_node->nodeName === 'widget' &&
                        $parsed_object->id !== null
                    ) {
                        $this->widgets[$parsed_object->id] = $parsed_object;
                    }

                    $this->attachToParent($parsed_object, $parent);
                    $this->parseUI($child_node, $parsed_object);
                }
            }
        }

        array_pop($this->stack);
    }