当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Parser.parseString方法代码示例

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


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

示例1: readXML

function readXML(file:string){
    var parser = new xml2js.Parser();
    parser.parseString(file, (err: any, result: any) => {
        analyser.getTransactionsXML(result.TransactionList.SupportTransaction);
    });
}
开发者ID:BenNaccarato,项目名称:SoftBank,代码行数:6,代码来源:app.ts

示例2: Promise

 return new Promise((resolve, reject) => {
     xmlParser.parseString(xmlString, (err: Error, result: any) => {
         return err ? reject(err) : resolve(result);
     });
 });
开发者ID:Real-Currents,项目名称:brackets,代码行数:5,代码来源:xml-utils.ts

示例3: function

fs.readFile(file_xml, function(err, data) {
	console.log	("*** start reading ***");
	parser.parseString(data);
});
开发者ID:ekzemplaro,项目名称:data_base_language,代码行数:4,代码来源:xml_update.ts

示例4: updateSettingsFileAsRequired

export async function updateSettingsFileAsRequired(settingsFile: string, isParallelRun: boolean, tiaConfig: models.TiaConfiguration, vsVersion: number, videoCollector: boolean, overrideParametersString: string) : Promise<string>
{
    var defer=Q.defer<string>();
    var result: any;

    if(!isParallelRun && !videoCollector && !tiaConfig.tiaEnabled && !overrideParametersString) {
        defer.resolve(settingsFile);
        return defer.promise;
    }

    //Get extension of settings file and contents
    var settingsExt = null;
    if (settingsFile && fs.lstatSync(settingsFile).isFile() && settingsFile.split('.').pop().toLowerCase() === "testsettings") {
        settingsExt=testSettingsExt;
        result = await utils.Helper.getXmlContents(settingsFile);
        if(!result || result.TestSettings === undefined) {
            tl.warning(tl.loc('InvalidSettingsFile', settingsFile));
            settingsExt = null;
        }
    } else if (settingsFile && utils.Helper.pathExistsAsFile(settingsFile)) {
        settingsExt = runSettingsExt;
        result = await utils.Helper.getXmlContents(settingsFile);
        if(!result || result.RunSettings === undefined) {
            tl.warning(tl.loc('InvalidSettingsFile', settingsFile));
            settingsExt = null;
        }
    }

    if (overrideParametersString) {
        if(settingsExt === runSettingsExt) {
            result = updateRunSettingsWithParameters(result, overrideParametersString);
        } else {
            tl.warning(tl.loc('overrideNotSupported'));
        }
    }

    if (isParallelRun) {        
        if (settingsExt === testSettingsExt) {
            tl.warning(tl.loc('RunInParallelNotSupported'));
        } else if (settingsExt === runSettingsExt) {
            tl.debug("Enabling run in parallel by editing given runsettings.")            
            result = await setupRunSettingsFileForRunConfig(result, {MaxCpuCount: 0});            
        } else {
            tl.debug("Enabling run in parallel by creating new runsettings.");            
            settingsExt = runSettingsExt;
            result = await CreateSettings(runSettingsForParallel);
        }
    }

    if (videoCollector) {
        //Enable video collector only in test settings.
        var videoCollectorNode = null;
        parser.parseString(VideoDataCollectorTemplate, function(err, data) {
            if(err) {
                defer.reject(err);
            }
            videoCollectorNode = data;
            });
        if (settingsExt === testSettingsExt) {
            tl.debug("Enabling video data collector by editing given testsettings.")
            result = updateTestSettingsWithDataCollector(result, VideoCollectorFriendlyName, videoCollectorNode);
        } else if (settingsExt === runSettingsExt) {
            tl.warning(tl.loc('VideoCollectorNotSupportedWithRunSettings'));
        } else {
            tl.debug("Enabling video data collection by creating new test settings.")
            settingsExt = testSettingsExt;
            result = await CreateSettings(testSettingsTemplate);
            result = updateTestSettingsWithDataCollector(result, VideoCollectorFriendlyName, videoCollectorNode)
        }
    }
    
    if (tiaConfig.tiaEnabled) {        
        var testImpactCollectorNode = null;
        parser.parseString(TestImpactDataCollectorTemplate, function(err, data) {
            if(err) {
                defer.reject(err);
            }
            testImpactCollectorNode = data;
            if(tiaConfig.useNewCollector) {
                testImpactCollectorNode.DataCollector.$.codebase = getTraceCollectorUri(vsVersion);
            }        
            testImpactCollectorNode.DataCollector.Configuration[0].ImpactLevel = getTIALevel(tiaConfig);
            if (getTIALevel(tiaConfig) === 'file') {
                testImpactCollectorNode.DataCollector.Configuration[0].LogFilePath = 'true';
            }
            if (tiaConfig.context === "CD") {
                testImpactCollectorNode.DataCollector.Configuration[0].RootPath = "";
            } else {
                testImpactCollectorNode.DataCollector.Configuration[0].RootPath = tiaConfig.sourcesDir;
            }
        });
        //var baseLineBuildId = await utilities.readFileContents(tiaConfig.baseLineBuildIdFile, "utf-8");

        if(settingsExt === testSettingsExt)
        {
            tl.debug("Enabling Test Impact collector by editing given testsettings.")
            result = updateTestSettingsWithDataCollector(result, TestImpactFriendlyName, testImpactCollectorNode);
            //result = await setupTestSettingsFileForRunConfig(result, { TestImpact : { '$': {enabled: 'true'} }, BaseLineRunId : baseLineBuildId});
        } else if (settingsExt === runSettingsExt) {
            tl.debug("Enabling Test Impact collector by editing given runsettings.")
//.........这里部分代码省略.........
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:101,代码来源:settingshelper.ts

示例5: parseString

 parseString(str: string , cb?: Function) {
   this.parser.parseString(str, cb);
 }
开发者ID:Codesleuth,项目名称:esendex-node,代码行数:3,代码来源:xmlparser.ts


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