使用xml2js解析xml出错

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

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

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

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

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

  { '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,

 normalize: false,
 xmlns: false,
 lowercase: undefined },
阅读 2.2k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题