热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

使用xml2js解析xml出错

node.js萌新,在使用xml2js解析xml文件时没有得到真实的数据

node.js萌新,在使用xml2js解析xml文件时没有得到真实的数据



我的一个猜测,是不是我的数据在'soap:Body': [ [Object] 这个元素里面,如果是的话,我要如何才能获取???谢谢

我使用官网的示例代码可以正确的将xml解析为json,但真实的数据无法解析
我使用的代码如下
xml = '......'




parseString(xml, function(err, result) {
... console.log(result);
... })

结果如下:
{ 'soap:Envelope':
{ '$':

1
2
3
4
  { 'xmlns:soap': 'http://schemas.xmlsoap.org/soap/envelope/',

    'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',

    'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema' },

 'soap:Body': [ [Object] ] } }

{ comment: '',
sgmlDecl: '',
textNode: '',
tagName: '',
doctype: '',
procInstName: '',
procInstBody: '',
entity: '',
attribName: '',
attribValue: '',
cdata: '',
script: '',
c: '',
q: '',
bufferCheckPosition: 65536,
opt:
{ trim: false,

1
2
3
 normalize: false,

 xmlns: false,

 lowercase: undefined },



   



推荐阅读
author-avatar
mobiledu2502886053
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有