package net.sourceforge.phpeclipse.wiki.actions.mediawiki.connect;
+
+import java.io.InputStream;
+
//Parts of this sources are copied and modified from the jEdit Wikipedia plugin:
//http://www.djini.de/software/wikipedia/index.html
//
//with permission from the original author: Daniel Wunsch
public class Parsed {
- String timestamp;
+ /**
+ * 6lt;page6gt; XML data from Wikipedia Special:Export pages
+ * may be <code>null</code>
+ *
+ */
+ /*package private*/ String xmlData=null;
+ /**
+ * timeStamp represented in XML format from Wikipedia Special:Export pages
+ */
+ /*package private*/ String timestamp=null;
- String title;
+ /*package private*/ String title=null;
- String body;
+ /*package private*/ String body=null;
+
+ /*package private*/ Parsed() {
+ }
public Parsed(String timeStamp, String title, String body) {
+ this.xmlData = "";
this.timestamp = timeStamp;
this.title = title;
this.body = body;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("==>Title:\n");
+ if (title!=null) {
+ buffer.append(title);
+ }
+ buffer.append("==>Timestamp:\n");
+ if (timestamp!=null) {
+ buffer.append(timestamp);
+ }
+ buffer.append("==>Body:\n");
+ if (body!=null) {
+ buffer.append(body);
+ }
+ return buffer.toString();
+ }
+ /**
+ * @return Returns the body.
+ */
+ public String getBody() {
+ return body;
+ }
+ /**
+ * @return Returns the timestamp.
+ */
+ public String getTimestamp() {
+ return timestamp;
+ }
+
+ public String getDateTimestamp() {
+ if (timestamp!=null) {
+ StringBuffer buffer = new StringBuffer();
+ // 2004-11-22T12:41:10Z
+ buffer.append(timestamp.substring(0,4)); //year
+ buffer.append(timestamp.substring(5,7)); //month
+ buffer.append(timestamp.substring(8,10)); //day
+ buffer.append(timestamp.substring(11,13));//hour
+ buffer.append(timestamp.substring(14,16));//minute
+ buffer.append(timestamp.substring(17,19));//second
+ return buffer.toString();
+ }
+ return "";
+ }
+ /**
+ * @return Returns the title.
+ */
+ public String getTitle() {
+ return title;
+ }
+ /**
+ * @return Returns the xmlData.
+ */
+ public String getXmlData() {
+ return xmlData;
+ }
}
\ No newline at end of file