我正在搜索空的 xml 标签。例如,
<employee>
<name></name>
</employee>
<employee>
<name>abc</name>
</employee>
这里如何使用 Node.js 查找空标签(名称标签)?
最佳答案
你必须遍历所有相关标签并检查它们的内容。如果发现内容为空,则标记为空。下面是一段代码,可以在整个过程中为您提供帮助。
var emptytext=txtElement[0].childNodes[0];
if(emptytext===null)
{
alert("Text is empty");
}
关于javascript - 如何使用 Node.js 在 xml 中查找空元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30683683/