1
2
3
4
5
6
7
8
9
10
11 package org.mule.transformers.xml;
12
13 import org.mule.umo.transformer.TransformerException;
14
15
16
17
18 public class DomDocumentToXml extends AbstractXmlTransformer
19 {
20
21 public DomDocumentToXml()
22 {
23 setReturnClass(String.class);
24 }
25
26 public Object doTransform(Object src, String encoding) throws TransformerException
27 {
28 try
29 {
30
31
32 if (byte[].class.equals(returnClass))
33 return convertToBytes(src, encoding);
34 else
35 return convertToText(src, encoding);
36 }
37 catch (Exception e)
38 {
39 throw new TransformerException(this, e);
40 }
41 }
42
43 }