简体   繁体   English

从 node.js 中的 xml 检索数据

[英]Retrive data from a xml in node.js

I have a xml request tags like this:我有一个像这样的 xml 请求标签:

<request>

<name>john</name>
<age>22</age>

</request>

i want to get the data from xmla tags like this我想从这样的 xmla 标签中获取数据

var name=john
var age=22


how i can parse the xml in node.js我如何解析 node.js 中的 xml

Id recommend looking into some NPM packages that solve this problem.我建议查看一些解决此问题的 NPM 包。

Having a look into some of the packages on NPM, this seems to be a very popular package to solve your problem:查看 NPM 上的一些包,这似乎是一个非常受欢迎的包来解决您的问题:

xml2js xml2js

This package has over 6 million downloads per week that suggests its both a capable package and one that will more than likely remain actively maintained.该软件包每周有超过600 万次下载,这表明它既是一个功能强大的软件包,又很可能保持积极维护。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM