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

TypeScript xml2js.parseString函数代码示例

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

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



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

示例1: Promise

    return new Promise((resolve) => {
      let SqliteSyncObject = {
        SyncId: data[0].SyncId,
        TableName: data[0].TableName,
        Records: [],
        QueryInsert: data[0].QueryInsert,
        QueryUpdate: data[0].QueryUpdate,
        QueryDelete: data[0].QueryDelete,
        TriggerInsert: data[0].TriggerInsert,
        TriggerUpdate: data[0].TriggerUpdate,
        TriggerDelete: data[0].TriggerDelete,
        TriggerInsertDrop: data[0].TriggerInsertDrop,
        TriggerUpdateDrop: data[0].TriggerUpdateDrop,
        TriggerDeleteDrop: data[0].TriggerDeleteDrop,
      }

      xml2js.parseString(data[0].Records, function (err, result) {
        if(result && result.records){
          for(let i = 0; i < result.records.r.length; i++){
            let record = {
              Action: result.records.r[i].$.a,
              Columns: []
            };
            for(let ii = 0; ii < result.records.r[i].c.length; ii++){
              record.Columns.push(result.records.r[i].c[ii]);
            }
            SqliteSyncObject.Records.push(record);
          }
          resolve(SqliteSyncObject);
        }
        else{
          resolve(SqliteSyncObject);
        }
      });
    })
开发者ID:sqlite-sync,项目名称:SQLite-sync.com,代码行数:35,代码来源:sqlite-sync.ts


示例2: handleError

 fs.readFile(inputFilePath, (err, data) => {
     handleError(err);
     xml2js.parseString(data.toString(), (err, result) => {
         handleError(err);
         writeFile(outputFilePath, xmlObjectToString(result));
     });
 });
开发者ID:unional,项目名称:MS-TypeScript,代码行数:7,代码来源:generateLocalizedDiagnosticMessages.ts


示例3: containsParamFile

export async  function containsParamFile(webAppPackage: string ) {
    var msDeployPath = await getMSDeployFullPath();
    var msDeployCheckParamFileCmdArgs = "-verb:getParameters -source:package=\"" + webAppPackage + "\"";
    
    var msDeployParamFile = tl.getVariable('System.DefaultWorkingDirectory') + '\\' + 'msDeployParam.bat';
    var parameterFile = tl.getVariable('System.DefaultWorkingDirectory') + '\\' + 'parameter.xml';
    
    var silentCommand = '@echo off \n';
    var msDeployCommand = '"' + msDeployPath + '" ' + msDeployCheckParamFileCmdArgs + " > \"" + parameterFile + "\"";
    var batchCommand = silentCommand + msDeployCommand;

    tl.writeFile(msDeployParamFile, batchCommand);
    tl._writeLine(tl.loc("Runningcommand", msDeployCommand));

    var taskResult = tl.execSync("cmd", ['/C', msDeployParamFile], { failOnStdErr: true, silent: true });
    var paramContentXML = fs.readFileSync(parameterFile);
    var isParamFilePresent = false;
    await parseString(paramContentXML, (error, result) => {
        if(error) {
            throw new Error(error);
        }
        if(result['output']['parameters'][0] ) {
            isParamFilePresent = true;
        }
    });
    tl.debug(tl.loc("Isparameterfilepresentinwebpackage0", isParamFilePresent));
    return isParamFilePresent;
}
开发者ID:HSAR,项目名称:vso-agent-tasks,代码行数:28,代码来源:msdeployutility.ts


示例4: convertXml2js

export function convertXml2js(content: string): JsonObject|null {
  let retResult: JsonObject = null;
  xml2js.parseString(content, (err, result) => {
    retResult = result;
  });
  return retResult;
}
开发者ID:angular,项目名称:webdriver-manager,代码行数:7,代码来源:file_utils.ts


示例5: request

 request(this.options, function (error:any, response:any,body:any) {
     xml2js.parseString(body, function (err:any, result:any) {
         var backData = that._parse(result);
         if(callback){
             callback(backData);
         }
     });
 });
开发者ID:kotcmm,项目名称:writecnblog,代码行数:8,代码来源:xmlrpc.ts


示例6: httpGet

 return httpGet('http://live.bilibili.com/api/playurl', {cid: videoId}).then((xml:string)=> {
         let downloadUrl = null;
         parseString(xml, function (err, result) {
             if (!err && Object.keys(result)) {
                 downloadUrl = result.video.durl[0].url[0]
             }
         });
         return downloadUrl;
     }
开发者ID:xiaopohou,项目名称:bilibili-live-video-noty,代码行数:9,代码来源:link.ts


示例7: parseString

 const translated = await new Promise<string>((resolve, reject) => {      
   parseString(body, (err, result) => {
     if (err) { reject(err) }
     console.log(body + '\n↓ parsing XML to JS object');
     console.log(result);
     console.log('\n');
     resolve(result.string._);
   });
 });
开发者ID:ovrmrw,项目名称:ms-translator-text-to-text-nodejs,代码行数:9,代码来源:translator.ts


示例8: Promise

 return new Promise((resolve, reject) => {
   xml2js.parseString(xml, options || defaultParseOptions, (err, data) => {
     if (err) {
       callback && callback(err);
       return reject(err);
     }
     callback && callback(null, data);
     resolve(data);
   });
 });
开发者ID:hstarorg,项目名称:wechat-admin,代码行数:10,代码来源:xmlHelper.ts


示例9: parseXML

function parseXML(content: string) {
  let xml: Object;
  xml2js.parseString(content, { async: false },(err, result) => {
    if (err) {
      throw err;
    }
    xml = result;
  });
  return xml;
}
开发者ID:pxpeterxu,项目名称:xar-js,代码行数:10,代码来源:create.ts


示例10: resolve

		/**
		 *
		 */
		public resolve(response: CasparCGSocketResponse): Object {
			let parseNumbers = function (str: any) {
				if (!isNaN(str)) {
					str = str % 1 === 0 ? parseInt(str, 10) : parseFloat(str)
				}
				return str
			}
			let parseBooleans = function (str: any) {
				if (str === true || str.toString().toLowerCase() === 'true') {
					return true
				} else if (str === false || str.toString().toLowerCase() === 'false') {
					return false
				}
				return str
			}
			let parseLowerCase = function (str: any) {
				return str.toString().toLowerCase()
			}

			let returnFalse: Error | undefined
			let returnData: Object | undefined

			xmlParser(
				response.items[0].replace('\n', ''),
				{ explicitRoot: false, async: false, trim: true, explicitArray: false, mergeAttrs: true, attrValueProcessors: [parseNumbers], valueProcessors: [parseNumbers, parseBooleans], tagNameProcessors: [parseLowerCase], attrNameProcessors: [parseLowerCase] },
				(error, result) => {
					returnFalse = error
					returnData = result
				})

			return returnFalse ? {} : returnData || {}
		}
开发者ID:SuperFlyTV,项目名称:casparcg-connection,代码行数:35,代码来源:ResponseValidators.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript xml2js.Builder类代码示例发布时间:2022-05-25
下一篇:
TypeScript xml-writer.toString函数代码示例发布时间: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