view src/fdl/test/debug/ConnectionXMLBuilder.java @ 91:4df1d50df52a

Ring: fdl.test.debug
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Tue, 16 Feb 2010 03:58:06 +0900 (2010-02-15)
parents c0575f877591
children
line wrap: on
line source
package fdl.test.debug;

import org.w3c.dom.*;

public class ConnectionXMLBuilder extends XMLBuilder {
	private Element connections;
	
	public ConnectionXMLBuilder(int id) {
		super();
		connections = document.createElement("connections");
		connections.setAttribute("id", new Integer(id).toString());
		document.appendChild(connections);
	}
	
	public void appendConnection(int mytid, String host, int port, int tid){
		Element connection = document.createElement("connection");
		connection.setAttribute("id", new Integer(mytid).toString());
		Element h = document.createElement("host");
		h.setTextContent(host);
		Element p = document.createElement("port");
		p.setAttribute("id", new Integer(port).toString());
		Element t = document.createElement("tid");
		t.setAttribute("id", new Integer(tid).toString());

		connections.appendChild(connection);
		connection.appendChild(h);
		connection.appendChild(p);
		connection.appendChild(t);
	}
	
}