<!DOCTYPE html>src="/statics/demosource/loadxmldoc.js"xmlDoc=loadXMLDoc("/statics/demosource/books.xml");x=xmlDoc.getElementsByTagName("title");//add a new attribute to each title elementfor(i=0;i<x.length;i++){x[i].setAttribute("edition","first");}//Output title and edition valuefor (i=0;i<x.length;i++){document.write(x[i].childNodes[0].nodeValue);document.write(" - Edition: ");document.write(x[i].getAttribute("edition"));document.write("<br>");}