I’ve such a xml string as following:
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");
}
How to write a function to get the node as string?(make the alert execute)
try this: