Map<String, String> attributes = (Map<String, String>)contentVersion.get("contentVersionAttributes");
DOMBuilder domBuilder = new DOMBuilder();
Document document = domBuilder.createDocument();
Element rootElement = domBuilder.addElement(document, "root");
domBuilder.addAttribute(rootElement, "xmlns", "x-schema:Schema.xml");
Element attributesRoot = domBuilder.addElement(rootElement, "attributes");
Iterator<String> attributesIterator = attributes.keySet().iterator();
while(attributesIterator.hasNext())