nsIINIParserFactory 编辑
xpcom/ds/nsIINIParser.idl
Scriptable This interface is used to create nsIINIParser
objects for use in parsing INI files. 1.0 66 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论