01: // Copyright (c) 2001 Per M.A. Bothner and Brainfood Inc.
02: // This is free software; for terms and warranty disclaimer see ./COPYING.
03:
04: package gnu.kawa.xml;
05:
06: import gnu.mapping.*;
07: import gnu.lists.*;
08: import gnu.xml.*;
09:
10: /** A 1-argument Procedure that takes a value and return output in XML syntax.
11: */
12:
13: public class OutputAsXML extends Procedure1 {
14: public int numArgs() {
15: return 0x1001;
16: }
17:
18: public Object apply1(Object arg) {
19: CharArrayOutPort port = new CharArrayOutPort();
20: XMLPrinter out = new XMLPrinter(port);
21: out.writeObject(arg);
22: out.flush();
23: return new FString(port.toCharArray());
24: }
25: }
|