/*
 * Created on Aug 20, 2003
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package TestClasses;

/**
 * @author student
 *
 * To change the template for this generated type comment go to
 * 
 */
import java.io.*;
import java.util.*;
import nz.co.cks.tms.xml.*;
public class StringWriterTest {

	public static void main(String[] args) {
		try{
				//FileWriter writer = new FileWriter("test.xml");
				StringWriter writer = new StringWriter();
				System.out.println("XmlGenerator ncbServiceAuthXml started..");

				/** Initialise **/
				TmsNcbServiceAuth tmsncbserviceauth = new TmsNcbServiceAuth();
				NcbService ncbservice = new NcbService();
								
				/** set simpleTypes **/
				Attrib att = new Attrib();
				att.setName("Test");
				att.setValue("Test");
				ncbservice.addAttrib(att);
				ncbservice.setServiceCode("Test");
							
				/** Add to parent **/
				tmsncbserviceauth.addNcbService(ncbservice);
		
				/** Set attributes **/
				tmsncbserviceauth.setNcbId(22);
				tmsncbserviceauth.setNcbConnectionLimit(-1);
				Date date = new Date();
				tmsncbserviceauth.setNcbServiceAuthDateTime(date);

				/** Get XML Packet **/
				tmsncbserviceauth.marshal(writer);
	
				
				System.out.println("stringwriter.toString ::: "+writer.toString());
			}
			catch(Exception e){
				System.out.println("EXCEPTION! : "+e.toString());
			}

		
	}
}
