Mercurial > hg > RemoteEditor > REPSessionManager
view test/XMLTest.java @ 221:6cd4aab9fea3
*** empty log message ***
author | kono |
---|---|
date | Sun, 31 Aug 2008 12:06:07 +0900 |
parents | 763aad2da6b3 |
children | c83a3faec487 |
line wrap: on
line source
package test; import rep.Editor; import rep.Session; import rep.SessionList; import rep.xml.SessionXMLDecoder; import rep.xml.SessionXMLEncoder; public class XMLTest { public static void main(String[] args){ Editor editor = new Editor(0, null); editor.setEID(1); editor.setHost("firefly.cr.ie.u-ryukyu.ac.jp"); //editor.setPort("56789"); editor.setName("Test.java"); Editor editor2 = new Editor(1, null); editor2.setEID(2); editor2.setHost("teto.cr.ie.u-ryukyu.ac.jp"); //editor2.setPort("45678"); Session session = new Session(editor); session.addEditor(editor); session.addEditor(editor2); SessionList sessionlist = new SessionList(); sessionlist.setMaxHost("naha.ie.u-ryukyu.ac.jp"); sessionlist.addSession(session); /*** SessionList から XML へ ***/ //SessionXMLEncoder encoder = new SessionXMLEncoder(sessionlist.getList()); SessionXMLEncoder encoder = new SessionXMLEncoder(sessionlist); System.out.println(encoder.sessionListToXML()); /*** XML から SessionList へ ***/ SessionXMLDecoder decoder = new SessionXMLDecoder(); SessionList sessionlist2 = decoder.decode(encoder.sessionListToXML()); /*** SessionList から XML へ ***/ //SessionXMLEncoder encoder2 = new SessionXMLEncoder(sessionlist2.getList()); SessionXMLEncoder encoder2 = new SessionXMLEncoder(sessionlist2); System.out.println(encoder2.sessionListToXML()); /*** TestSAX ***/ String[] string = {encoder2.sessionListToXML(),}; TestSax.main(string); } }