nsIINIParser
objects for use in parsing INI files.
nsISupports
Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)See Example for how to use this interface.
nsIINIParser createINIParser(in nsILocalFile aINIFile); |
Creates an INIĀ parser, returning the nsIINIParser
object that you can use to parse it.
nsIINIParser createINIParser( in nsILocalFile aINIFile );
aINIFile
The nsIINIParser
object you can use to parse the INIĀ file.
To obtain a parser for an INI file, you can use code that looks like this:
To get an nsIINIParser
instance for an INI file, you may use the following code:
// create an nsILocalFile var cl = "@mozilla.org/file/local;1"; var interf = Components.interfaces.nsILocalFile; var file = Components.classes[cl].createInstance(interf); // init the file with the path to your ini file var path = "c:\\temp\\example.ini"; file.initWithPath(path); // create the nsIINIParserFactory var cl = "@mozilla.org/xpcom/ini-parser-factory;1"; var interf = Components.interfaces.nsIINIParserFactory; var iniFact = Components.manager.getClassObjectByContractID(cl,interf); // get the INIParser for the ini file var iniParser = iniFact.createINIParser(file);