public function toString($applystyles = true)
    {
        // create XsltProcessor if needed
        if ($applystyles && !empty($this->styles)) {
            $proc = self::stylesToProc($this->styles);
            $proc->registerPhpFunctions();
        }

        // source parsing if needed
        switch ($this->sourceType) {
            case self::SOURCE_TYPE_DOM:
                $dom = $this->source;
                break;
            case self::SOURCE_TYPE_SIMPLEXML:
                if (!isset($proc)) {
                    return $this->source->asXML();
                }
                // no break
            default:
                $dom = $this->toDOM(false);
        }

        // if no stylesheets were selected, just return XML string
        if (!isset($proc)) {
            if (!$dom instanceof DomDocument) {
                // when parameter for constructor was DomNode and not domdocument
                return $dom->ownerDocument->saveXML($dom);
            }

            return $dom->saveXML();
        }

        // apply stylesheets and return parsed data as string.
        return (string) $proc->transformToXML($dom);
    }
public function toString($applystyles = true)
    {
        // create XsltProcessor if needed
        if ($applystyles && !empty($this->styles)) {
            $proc = self::stylesToProc($this->styles);
            $proc->registerPhpFunctions();
        }

        // source parsing if needed
        switch ($this->sourceType) {
            case self::SOURCE_TYPE_DOM:
                $dom = $this->source;
                break;
            case self::SOURCE_TYPE_SIMPLEXML:
                if (!isset($proc)) {
                    return $this->source->asXML();
                }
                // no break
            default:
                $dom = $this->toDOM(false);
        }

        // if no stylesheets were selected, just return XML string
        if (!isset($proc)) {
            if (!$dom instanceof DomDocument) {
                // when parameter for constructor was DomNode and not domdocument
                return $dom->ownerDocument->saveXML($dom);
            }

            return $dom->saveXML();
        }

        // apply stylesheets and return parsed data as string.
        return (string) $proc->transformToXML($dom);
    }
public function toString ( $ applystyles = true ) { // create XsltProcessor if needed if ( $ applystyles && ! empty ( $ this -> styles ) ) { $ proc = self :: stylesToProc ( $ this -> styles ) ; $ proc -> registerPhpFunctions ( ) ; } // source parsing if needed switch ( $ this -> sourceType ) { case self :: SOURCE_TYPE_DOM : $ dom = $ this -> source ; break ; case self :: SOURCE_TYPE_SIMPLEXML : if ( ! isset ( $ proc ) ) { return $ this -> source -> asXML ( ) ; } // no break default : $ dom = $ this -> toDOM ( false ) ; } // if no stylesheets were selected, just return XML string if ( ! isset ( $ proc ) ) { if ( ! $ dom instanceof DomDocument ) { // when parameter for constructor was DomNode and not domdocument return $ dom -> ownerDocument -> saveXML ( $ dom ) ; } return $ dom -> saveXML ( ) ; } // apply stylesheets and return parsed data as string. return ( string ) $ proc -> transformToXML ( $ dom ) ; }
Converts source to XML string.

@param bool $applystyles Apply stylesheets yes/no. Default is true.

@return string

@todo support for passing XsltProcessor as parameter
@todo support for DomNode as source when passing data to XsltProcessor
Converts source to XML string .