OutputAsXML.java :  » Scripting » Kawa » gnu » kawa » xml » Java Open Source

Java Open Source » Scripting » Kawa 
Kawa » gnu » kawa » xml » OutputAsXML.java
// Copyright (c) 2001  Per M.A. Bothner and Brainfood Inc.
// This is free software;  for terms and warranty disclaimer see ./COPYING.

package gnu.kawa.xml;
import gnu.mapping.*;
import gnu.lists.*;
import gnu.xml.*;

/** A 1-argument Procedure that takes a value and return output in XML syntax.
 */

public class OutputAsXML extends Procedure1
{
  public int numArgs() { return 0x1001; }

  public Object apply1 (Object arg)
  {
    CharArrayOutPort port = new CharArrayOutPort();
    XMLPrinter out = new XMLPrinter(port);
    out.writeObject(arg);
    out.flush();
    return new FString(port.toCharArray());
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.