nsIINIParserFactory

This interface is used to create nsIINIParser objects for use in parsing INI files.
1.0
28
Introduced
Gecko 1.8
Inherits from: nsISupports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)

See Example for how to use this interface.

Method overview

nsIINIParser createINIParser(in nsILocalFile aINIFile);

Methods

createINIParser()

Creates an INIĀ parser, returning the nsIINIParser object that you can use to parse it.

nsIINIParser createINIParser(
  in nsILocalFile aINIFile
); 
Parameters
aINIFile
The INI file to parse.
Return value

The nsIINIParser object you can use to parse the INIĀ file.

Example

Obtaining a parser object

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

See also

Document Tags and Contributors

Last updated by: Sheppy,