• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript xml2js.Parser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中xml2js.Parser的典型用法代码示例。如果您正苦于以下问题:TypeScript Parser类的具体用法?TypeScript Parser怎么用?TypeScript Parser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Parser类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1:

		return new Promise<InputTypes.Schedule.ISchedule>((resolve: (schedule: InputTypes.Schedule.ISchedule) => void, reject: (reason: any) => void) => {
			const parser: Parser = this.getParser();
			parser.parseString(xml, (error: any, parsedXml: InputTypes.Schedule.ISchedule) => {
				if (error) {
					reject(error);
				}
				resolve(parsedXml);
			});
		});
开发者ID:CUMTD,项目名称:WebScheduleGenerator,代码行数:9,代码来源:xml-parser.ts


示例2: function

        fs.readFile(resxFilename, function(err: any, data: any) {
            const parser = new xml2js.Parser();

            parser.parseString(data, function (err: any, result: any) {
                 if (result !== undefined)
                 {
                     convertXmlToTypeScriptModelFile(result, resxFilename, typeScriptResourcesNamespace, virtualTypeScriptFolder);                       
                 }
            });  
        });    
开发者ID:mvdcorput,项目名称:node-resx-to-typescript,代码行数:10,代码来源:index.ts


示例3: function

 .then(function(xmlContents) {
     var parser = new xml2js.Parser();
     parser.parseString(xmlContents, function(err, result) {
         if (!err && result.RunSettings && result.RunSettings.RunConfiguration && result.RunSettings.RunConfiguration[0] &&
             result.RunSettings.RunConfiguration[0].ResultsDirectory && result.RunSettings.RunConfiguration[0].ResultsDirectory[0].length > 0) {
             defer.resolve(result.RunSettings.RunConfiguration[0].ResultsDirectory[0]);
         }
         else {
             defer.resolve(defaultResultsDirectory);
         }
     });
 })
开发者ID:Alekseypv,项目名称:vsts-tasks,代码行数:12,代码来源:vstest.ts


示例4: if

                .then(function(xmlContents) {
                    var parser = new xml2js.Parser();
                    parser.parseString(xmlContents, function(err, result) {
                        if (err) {
                            tl.warning("Error occured while reading run settings file. Error : " + err);
                            tl.debug("Error occured while setting run in parallel. Continuing...");
                            defer.resolve(settingsFile);
                            return defer.promise;
                        }

                        if (result.RunSettings === undefined) {
                            tl.warning("Failed to set run in parallel. Invalid run settings file.");
                            defer.resolve(settingsFile);
                            return defer.promise;
                        }

                        if (!result.RunSettings) {
                            result.RunSettings = { RunConfiguration: { MaxCpuCount: 0 } };
                        }
                        else if (!result.RunSettings.RunConfiguration || !result.RunSettings.RunConfiguration[0]) {
                            result.RunSettings.RunConfiguration = { MaxCpuCount: 0 };
                        }
                        else {
                            var runConfigArray = result.RunSettings.RunConfiguration[0];
                            runConfigArray.MaxCpuCount = 0;
                        }

                        var builder = new xml2js.Builder();
                        var runSettingsForParallel = builder.buildObject(result);
                        saveToFile(runSettingsForParallel)
                            .then(function(fileName) {
                                cleanUp(settingsFile);
                                defer.resolve(fileName);
                                return defer.promise;
                            })
                            .fail(function(err) {
                                tl.debug("Error occured while setting run in parallel. Continuing...");
                                tl.warning(err);
                                defer.resolve(settingsFile);
                            });
                    });
                })
开发者ID:Alekseypv,项目名称:vsts-tasks,代码行数:42,代码来源:vstest.ts


示例5: if

                .then(function (xmlContents) {
                    var parser = new xml2js.Parser();
                    parser.parseString(xmlContents, function (err, result) {
                        if (err) {
                            tl.warning(tl.loc('ErrorWhileReadingRunSettings', err));
                            tl.debug(exitErrorMessage);
                            defer.resolve(settingsFile);
                            return defer.promise;
                        }

                        if (result.RunSettings === undefined) {
                            tl.warning(tl.loc('FailedToSetRunInParallel'));
                            defer.resolve(settingsFile);
                            return defer.promise;
                        }

                        if (!result.RunSettings) {
                            result.RunSettings = { RunConfiguration: { MaxCpuCount: 0 } };
                        }
                        else if (!result.RunSettings.RunConfiguration || !result.RunSettings.RunConfiguration[0]) {
                            result.RunSettings.RunConfiguration = { MaxCpuCount: 0 };
                        }
                        else {
                            var runConfigArray = result.RunSettings.RunConfiguration[0];
                            runConfigArray.MaxCpuCount = 0;
                        }

                        var builder = new xml2js.Builder();
                        var runSettingsForParallel = builder.buildObject(result);
                        saveToFile(runSettingsForParallel, runSettingsExt)
                            .then(function (fileName) {
                                cleanUp(settingsFile);
                                defer.resolve(fileName);
                                return defer.promise;
                            })
                            .fail(function (err) {
                                tl.debug(exitErrorMessage);
                                tl.warning(err);
                                defer.resolve(settingsFile);
                            });
                    });
                })
开发者ID:ColinDabritz,项目名称:vsts-tasks,代码行数:42,代码来源:vstest.ts


示例6: function

        .then(function (xmlContents) {
            var parser = new xml2js.Parser();
            parser.parseString(xmlContents, function (err, result) {
                if (!err && result.RunSettings && result.RunSettings.RunConfiguration && result.RunSettings.RunConfiguration[0] &&
                    result.RunSettings.RunConfiguration[0].ResultsDirectory && result.RunSettings.RunConfiguration[0].ResultsDirectory[0].length > 0) {
                    var resultDirectory = result.RunSettings.RunConfiguration[0].ResultsDirectory[0];
                    resultDirectory = resultDirectory.trim();

                    if (resultDirectory) {
                        // path.resolve will take care if the result directory given in settings files is not absolute.
                        defer.resolve(path.resolve(path.dirname(runSettingsFile), resultDirectory));
                    }
                    else {
                        defer.resolve(defaultResultsDirectory);
                    }
                }
                else {
                    defer.resolve(defaultResultsDirectory);
                }
            });
        })
开发者ID:ColinDabritz,项目名称:vsts-tasks,代码行数:21,代码来源:vstest.ts


示例7:

fs.readFile (file_in,function (err,data)
	{
	parser.parseString (data,function (err,result)
		{
		text_manipulate.dict_display_proc (result);
		console.log ("*** 終了 ***");
		});
	});
开发者ID:ekzemplaro,项目名称:data_base_language,代码行数:8,代码来源:xml_read.ts


示例8: CreateSettings

function CreateSettings(runSettingsContents: string) : Q.Promise<any> {
    var defer=Q.defer<any>();
    parser.parseString(runSettingsContents, function (err, result) {
        if(err) {      
            defer.reject(err);
        }
        defer.resolve(result);                  
    });
    return defer.promise; 
}
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:10,代码来源:settingshelper.ts


示例9: errCb

 fs.readFile('config.xml', (err: any, data: any) => {
   if (err) {
     errCb(err);
     return;
   }
   parser.parseString(data, (err: any, result: any) => {
     if (err) {
       errCb(err);
       return;
     }
     cb(parseConfig(result));
   });
 });
开发者ID:Kode-Kitchen,项目名称:ionic-app-scripts,代码行数:13,代码来源:cordova-config.ts



注:本文中的xml2js.Parser类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript xml2json.toJson函数代码示例发布时间:2022-05-25
下一篇:
TypeScript xml2js.Builder类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap