8adf257b0b6c247311e62218fd36ae7c69397eb2
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.wiki / src / net / sourceforge / phpeclipse / wiki / actions / mediawiki / connect / Parsed.java
1 package net.sourceforge.phpeclipse.wiki.actions.mediawiki.connect;
2
3 import java.io.InputStream;
4
5 //Parts of this sources are copied and modified from the jEdit Wikipedia plugin:
6 //http://www.djini.de/software/wikipedia/index.html
7 //
8 //The modified sources are available under the "Common Public License"
9 //with permission from the original author: Daniel Wunsch
10
11 public class Parsed {
12   /**
13    * 6lt;page6gt; XML data from Wikipedia Special:Export pages
14    * may be <code>null</code>
15    * 
16    */
17   /*package private*/ String xmlData=null; 
18   /**
19    * timeStamp represented in XML format from Wikipedia Special:Export pages
20    */
21   /*package private*/ String timestamp=null;
22
23   /*package private*/ String title=null;
24
25   /*package private*/ String body=null;
26
27   /*package private*/ Parsed() {
28   }
29
30   public Parsed(String timeStamp, String title, String body) {
31     this.xmlData = "";
32     this.timestamp = timeStamp;
33     this.title = title;
34     this.body = body;
35   }
36   /* (non-Javadoc)
37    * @see java.lang.Object#toString()
38    */
39   public String toString() {  
40     StringBuffer buffer = new StringBuffer();
41     buffer.append("==>Title:\n");
42     if (title!=null) {
43       buffer.append(title);
44     }
45     buffer.append("==>Timestamp:\n");
46     if (timestamp!=null) {
47       buffer.append(timestamp);
48     }
49     buffer.append("==>Body:\n");
50     if (body!=null) {
51       buffer.append(body);
52     }
53     return buffer.toString();
54   }
55   /**
56    * @return Returns the body.
57    */
58   public String getBody() {
59     return body;
60   }
61   /**
62    * @return Returns the timestamp.
63    */
64   public String getTimestamp() {
65     return timestamp;
66   }
67   
68   public String getDateTimestamp() {
69     if (timestamp!=null) {
70       StringBuffer buffer = new StringBuffer();
71       // 2004-11-22T12:41:10Z
72       buffer.append(timestamp.substring(0,4));  //year
73       buffer.append(timestamp.substring(5,7));  //month
74       buffer.append(timestamp.substring(8,10)); //day
75       buffer.append(timestamp.substring(11,13));//hour
76       buffer.append(timestamp.substring(14,16));//minute
77       buffer.append(timestamp.substring(17,19));//second
78       return buffer.toString();
79     } 
80     return "";
81   }
82   /**
83    * @return Returns the title.
84    */
85   public String getTitle() {
86     return title;
87   }
88   /**
89    * @return Returns the xmlData.
90    */
91   public String getXmlData() {
92     return xmlData;
93   }
94 }