src/CFPropertyList/CFPropertyList.php
public function toXML($formatted = false)
    {
        $domimpl = new DOMImplementation();
      // <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
        $dtd = $domimpl->createDocumentType('plist', '-//Apple//DTD PLIST 1.0//EN', 'http://www.apple.com/DTDs/PropertyList-1.0.dtd');
        $doc = $domimpl->createDocument(null, "plist", $dtd);
        $doc->encoding = "UTF-8";

      // format output
        if ($formatted) {
            $doc->formatOutput = true;
            $doc->preserveWhiteSpace = true;
        }

      // get documentElement and set attribs
        $plist = $doc->documentElement;
        $plist->setAttribute('version', '1.0');

      // add PropertyList's children
        $plist->appendChild($this->getValue(true)->toXML($doc));

        return $doc->saveXML();
    }
public function toXML($formatted = false)
    {
        $domimpl = new DOMImplementation();
      // <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
        $dtd = $domimpl->createDocumentType('plist', '-//Apple//DTD PLIST 1.0//EN', 'http://www.apple.com/DTDs/PropertyList-1.0.dtd');
        $doc = $domimpl->createDocument(null, "plist", $dtd);
        $doc->encoding = "UTF-8";

      // format output
        if ($formatted) {
            $doc->formatOutput = true;
            $doc->preserveWhiteSpace = true;
        }

      // get documentElement and set attribs
        $plist = $doc->documentElement;
        $plist->setAttribute('version', '1.0');

      // add PropertyList's children
        $plist->appendChild($this->getValue(true)->toXML($doc));

        return $doc->saveXML();
    }
public function toXML ( $ formatted = false ) { $ domimpl = new DOMImplementation ( ) ; // <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> $ dtd = $ domimpl -> createDocumentType ( 'plist' , '-//Apple//DTD PLIST 1.0//EN' , 'http://www.apple.com/DTDs/PropertyList-1.0.dtd' ) ; $ doc = $ domimpl -> createDocument ( null , "plist" , $ dtd ) ; $ doc -> encoding = "UTF-8" ; // format output if ( $ formatted ) { $ doc -> formatOutput = true ; $ doc -> preserveWhiteSpace = true ; } // get documentElement and set attribs $ plist = $ doc -> documentElement ; $ plist -> setAttribute ( 'version' , '1.0' ) ; // add PropertyList's children $ plist -> appendChild ( $ this -> getValue ( true ) -> toXML ( $ doc ) ) ; return $ doc -> saveXML ( ) ; }
Convert CFPropertyList to XML
@param bool $formatted Print plist formatted (i.e. with newlines and whitespace indention) if true; defaults to false
@return string The XML content
Convert CFPropertyList to XML