def self.intern_xml(xml)
return nil unless xml
bad_xml_doctype = /^.*<!DOCTYPE plist PUBLIC -\/\/Apple Computer.*$/
if xml =~ bad_xml_doctype
xml.gsub!( bad_xml_doctype, Plist_Xml_Doctype )
Facter.debug("Had to fix plist with incorrect DOCTYPE declaration")
end
plist = CFPropertyList::List.new
begin
plist.load_str(xml)
rescue CFFormatError => e
raise RuntimeError, "A plist file could not be properly read by CFPropertyList: #{e.message}", e.backtrace
end
CFPropertyList.native_types(plist.value)
end