if (has_attributes) {
nsIDOMNamedNodeMap attributes = node.getAttributes();
long len = attributes.getLength();
System.out.println("The node has " + len + " attributes");
for (long i = 0; i < len; i++) {
nsIDOMAttr attribute = (nsIDOMAttr) attributes.item(i).queryInterface(nsIDOMAttr.NS_IDOMATTR_IID);
System.out.println("Attribute #" + i + " -> " + attribute.getName() + "=" + attribute.getValue());
}
}
else {
System.out.println("The node does not have attributes");
}