Tag: readxml

在“NodeJs”中读取写入XML节点值

任何人都可以指导我如何读/写在NodeJS xml2js.Parser()parsingXML节点值? 到目前为止,我的代码是作为stream程: var parser = new xml2js.Parser(); fs.readFile( './foo.xml', function(err, data) { parser.parseString(data, function (err, result) { console.dir(result); }); }); 我想读取result的值如下 result.to 我的XML: <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>