public function toSimpleXML($applystyles = true)
    {
        if ($applystyles && !empty($this->styles)) {
            $dom = $this->toDOM($applystyles);

            return simplexml_import_dom($dom);
        }

        switch ($this->sourceType) {
            case self::SOURCE_TYPE_DOM:
                return simplexml_import_dom($this->source);
            case self::SOURCE_TYPE_SIMPLEXML:
                return $this->source;
            case self::SOURCE_TYPE_OBJECT:
                $dom = $this->objectToDom($this->source);

                return simplexml_import_dom($dom);
            case self::SOURCE_TYPE_FILE:
                return simplexml_load_file($this->source);
            case self::SOURCE_TYPE_STRING:
                return simplexml_load_string($this->source);
        }
    }