我有一个如下的xml字符串:
str = "<myxml><Node id="1" attr1="a" attr2="b" />
<Node id="2" attr1="a" attr2="b" /><Node id="3" attr1="a" attr2="b" />
<Node id="4" attr1="a" attr2="b" /></myxml>"
function returnNodeAsStr(str) {
...
...
}
if(returnNodeAsStr(str) == '<Node id="1" attr1="a" attr2="b" />') {
alert("ok");
}
如何编写函数以将节点作为字符串获取?(使警报执行)