xmlDoc=loadXMLDoc("books.xml");
var x=xmlDoc.getElementsByTagName("book");
for(i=0;i<x.length;i++)
{
//the attlist variable will hold a NamedNodeMap
var attlist=x.item(i).attributes;
var att=attlist.getNamedItem("category");
document.write(att.value + "<br />")
}