Java DOM edit: Adding an Attribute to an Element
public void addAttribute(Document doc) { Element root = doc.getDocumentElement(); Element person = (Element)root.getFirstChild(); person.setAttribute("company","CastleWorks"); }