Created
June 29, 2012 05:55
-
-
Save knkumar/3016102 to your computer and use it in GitHub Desktop.
javascript iterate nodeList XML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var doc = xhreq.responseText; | |
var parser = new DOMParser(); | |
var link = parser.parseFromString(doc, 'text/xml'); | |
var items = link.documentElement.childNodes; | |
for (var item in items) { | |
if(item.nodeName == 'link'){ | |
for(var attr in item.attributes.name) { | |
if(item.attr.name == 'rel'){ | |
//do something awesome | |
return; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
But why is there no iterator object on a nodelist maybe we should write one?