class CFPropertyList::XML

def to_str(opts={})

opts = {}:: Specify options: :formatted - Use indention and line breaks
serialize CFPropertyList object to XML
def to_str(opts={})
  doc = LibXML::XML::Document.new
  doc.root = LibXML::XML::Node.new('plist')
  doc.encoding = LibXML::XML::Encoding::UTF_8
  doc.root['version'] = '1.0'
  doc.root << opts[:root].to_xml()
  # ugly hack, but there's no other possibility I know
  str = doc.to_s(:indent => opts[:formatted])
  str1 = String.new
  first = false
  str.each_line do
    |line|
    str1 << line
    unless(first) then
      str1 << "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" if line =~ /^\s*<\?xml/
    end
    first = true
  end
  return str1
end