Tove Jani Reminder Don't forget me this weekend! XML; $xml = new SimpleXMLElement($note); $xml->addAttribute("type","private"); $xml->body->addAttribute("date","2013-01-01"); echo $xml->asXML();