Mercurial > hg > RemoteEditor > REPSessionManager
diff test/SessionXMLParser.java @ 76:97ca5f5447cd
*** empty log message ***
author | pin |
---|---|
date | Tue, 04 Dec 2007 10:33:06 +0900 |
parents | |
children | a187180e0106 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/SessionXMLParser.java Tue Dec 04 10:33:06 2007 +0900 @@ -0,0 +1,55 @@ +package test; + +import java.io.IOException; +import java.io.StringReader; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.xml.sax.Attributes; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + +import rep.Editor; +import rep.Session; +import rep.SessionList; + +public class SessionXMLParser extends DefaultHandler{ + + private SessionList sessionlist; + private Editor editor; + + public void startDocument() { + System.out.println("Start Document."); + } + + public void startElement(String uri, String localName, String qName, Attributes attributes){ + + } + + + public static void main(String[] args) { + String string = null; + if(args.length > 0) { + string = args[0]; + } + try { + SAXParserFactory spfactory = SAXParserFactory.newInstance(); + SAXParser parser = spfactory.newSAXParser(); + InputSource source = new InputSource(new StringReader(string)); + parser.parse(source, new SessionXMLParser()); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ParserConfigurationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SAXException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +}