1 package org.kuali.ole.handler;
2
3 import com.thoughtworks.xstream.XStream;
4 import org.kuali.ole.bo.diagnostics.OleSRUDiagnostic;
5
6
7
8
9
10
11
12
13 public class OleSRUDiagnosticsHandler {
14
15
16
17
18
19
20
21 public String toXML(OleSRUDiagnostic oleSRUDiagnostic) {
22 StringBuffer stringBuffer = new StringBuffer();
23 stringBuffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<diagnostics>");
24 stringBuffer.append("\n");
25 XStream xStream = new XStream();
26 xStream.alias("diagnostic", OleSRUDiagnostic.class);
27 String xml = xStream.toXML(oleSRUDiagnostic);
28 xml = xml.replaceAll("<diagnostic>", "<diagnostic xmlns=\"http://www.loc.gov/zing/srw/diagnostic/\">");
29 xml += "\n</diagnostics>";
30 stringBuffer.append(xml);
31 return stringBuffer.toString();
32 }
33 }