Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

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

 Contributors to this page: Sheppy, Yuan.Xulei, trevorh
 Last updated by: Sheppy,