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();
    }