Windows 8 Metro App + Bind XML + querySelector("xmlnode")..getAttribute("xmlnodeattr")
===

Hi I need help on error check which currently I'm working on Metro App.

So basically like this I'm using WinJS.xhr

    function xhrRss(section, title, storyfile, thumbnail) {
            try {
                WinJS.xhr({ url: storyfile }).then(function (rss) {
                    var items = rss.responseXML.querySelectorAll("story");
                    for (var n = 0; n < items.length; n++) {
                        var article = {};
                        var imageArticle;
                        article.title = title;
                        article.section = items[n].querySelector("section").textContent;
                        article.image = items[n].querySelector("img").getAttribute("src"); //ERROR HERE
                        article.thumbnail = thumbnail;
                        article.content = items[n].querySelector("textbody").textContent;
                        if (section === 0) { section0List.push(article); }
                        else if (section === 1) { section1List.push(article); }
                        else if (section === 2) { section2List.push(article); }
                        else { }
                    }
                }, function (rss) {
                    window.console.log(rss);
                });
            }
            catch (err) {
                var outputArea = document.getElementById("xhrOutput");
                outputArea.innerHTML = err.message;
            }
        }


So my article.image = items[n].querySelector("img").getAttribute("src");
Return an error of JavaScript runtime error: Unable to get property 'attributes' of undefined or null reference


I know it would return an error because that node is not exist in some xmls, but some of my xmls has that 

    <xml>
        <section>section1</section>
        <img src="image.jpg" />
        <summary>lorem</summary>
    </xml>

So the question is how to validate it null or not 
I tried 

> if(items[n].querySelector("img").getAttribute("src") != null){DOES NOT
> WORK}

and

> if(!items[n].querySelector("img").getAttribute("src")){DOES NOT WORK
> EITHER}




