// avoid a thread with the entry's output representation
StringWriter sw = new StringWriter();
entryRep.write(sw);
entryRep.release();
DocumentLoader loader = new SAXDocumentLoader();
Document doc = loader.load(new StringReader(sw.toString()));
// mark the entry as edited
Date date = media.getEntry().edited();
// change the entry's edited element
Element edited = doc.getDocumentElement().getFirstElementNamed(AtomResource.EDITED_NAME);
if (edited!=null) {
edited.clear();
edited.addCharacters(toXSDDate(date));
}
Element content = doc.getDocumentElement().getFirstElementNamed(AtomResource.CONTENT_NAME);
content.setAttributeValue("src",slug);
Iterator<Element> links = doc.getDocumentElement().getElementsByName(AtomResource.LINK_NAME);
while (links.hasNext()) {
Element link = links.next();
if ("edit-media".equals(link.getAttributeValue("rel"))) {
link.setAttributeValue("href", slug);
}