* @return Xml representation of the repository descriptors
* @see org.apache.jackrabbit.webdav.xml.XmlSerializable#toXml(Document)
* @param document
*/
public Element toXml(Document document) {
Repository repository = getRepositorySession().getRepository();
Element report = DomUtil.createElement(document, "repositorydescriptors-report", NAMESPACE);
for (String key : repository.getDescriptorKeys()) {
Element elem = DomUtil.addChildElement(report, XML_DESCRIPTOR, NAMESPACE);
DomUtil.addChildElement(elem, XML_DESCRIPTORKEY, NAMESPACE, key);
for (Value v : repository.getDescriptorValues(key)) {
String value;
try {
value = v.getString();
} catch (RepositoryException e) {
log.error("Internal error while reading descriptor value: ", e);
value = repository.getDescriptor(key);
}
Element child = DomUtil.addChildElement(elem, XML_DESCRIPTORVALUE, NAMESPACE, value);
if (PropertyType.STRING != v.getType()) {
child.setAttribute(ATTR_VALUE_TYPE, PropertyType.nameFromValue(v.getType()));
}