Java DOM edit: Deleting Two Attributes
//An XML Document Containing Two Attributes /* <?xml version="1.0" standalone="yes"?> <!DOCTYPE folks [ <!ELEMENT folks (person)*> <!ELEMENT person (name | email)*> <!ELEMENT name (#PCDATA)> <!ELEMENT email (#PCDATA)> <!ATTLIST person extension CDATA #IMPLIED dept CDATA "staff"> ]> <folks> <person extension="3412" dept="medical"> <name>Doctor Polidori</name> <email>deft@jerk.net</email> </person> </folks> */ public void delAttribute(Document doc) { Element root = doc.getDocumentElement(); Element person = (Element)root.getFirstChild(); person.removeAttribute("extension"); person.removeAttribute("dept"); }