Module: Plist

Defined in:
lib/facter/util/plist/parser.rb,
lib/facter/util/plist.rb,
lib/facter/util/plist/generator.rb

Overview

--########################################################### Copyright 2006, Ben Bleything <ben@bleything.net> and # Patrick May <patrick@hexane.org> #

#

Distributed under the MIT license. #

++ See Plist::Emit.

Defined Under Namespace

Modules: Emit Classes: Listener, PArray, PData, PDate, PDict, PFalse, PInteger, PKey, PList, PReal, PString, PTag, PTrue, StreamParser

Constant Summary

VERSION =
'3.0.0'

Class Method Summary (collapse)

Class Method Details

+ (Object) parse_xml(filename_or_xml)

Note that I don't use these two elements much:

+ Date elements are returned as DateTime objects.
+ Data elements are implemented as Tempfiles

Plist::parse_xml will blow up if it encounters a data element. If you encounter such an error, or if you have a Date element which can't be parsed into a Time object, please send your plist file to plist@hexane.org so that I can implement the proper support.



24
25
26
27
28
29
30
# File 'lib/facter/util/plist/parser.rb', line 24

def Plist::parse_xml( filename_or_xml )
    listener = Listener.new
    #parser = REXML::Parsers::StreamParser.new(File.new(filename), listener)
    parser = StreamParser.new(filename_or_xml, listener)
    parser.parse
    listener.result
end