2002/07/01 21:01:01
[org.ibex.core.git] / src / org / xwt / XMLRPC.java
index 596151e..30cc98c 100644 (file)
@@ -74,6 +74,7 @@ class XMLRPC extends XML implements Function {
     // Methods to Recieve and parse XML-RPC Response ////////////////////////////////////////////////////
 
     public void startElement(String name, String[] keys, Object[] vals, int line, int col) {
+        content.reset();
         if (name.equals("fault")) fault = true;
         else if (name.equals("struct")) objects.setElementAt(new JSObject(false), objects.size() - 1);
         else if (name.equals("array")) objects.setElementAt(null, objects.size() - 1);
@@ -226,6 +227,26 @@ class XMLRPC extends XML implements Function {
             }
             sb.append("</string></value>\n");
 
+        } else if (o instanceof NativeDate) {
+            sb.append("                <value><dateTime.iso8601>");
+            NativeDate nd = (NativeDate)o;
+            Date d = new Date(nd.getRawTime());
+            sb.append(d.getYear() + 1900);
+            if (d.getMonth() + 1 < 10) sb.append('0');
+            sb.append(d.getMonth() + 1);
+            if (d.getDate() < 10) sb.append('0');
+            sb.append(d.getDate());
+            sb.append('T');
+            if (d.getHours() < 10) sb.append('0');
+            sb.append(d.getHours());
+            sb.append(':');
+            if (d.getMinutes() < 10) sb.append('0');
+            sb.append(d.getMinutes());
+            sb.append(':');
+            if (d.getSeconds() < 10) sb.append('0');
+            sb.append(d.getSeconds());
+            sb.append("</dateTime.iso8601></value>\n");
+
         } else if (o instanceof NativeArray) {
             if (tracker.get(o) != null) throw new JavaScriptException("attempted to send multi-ref data structure via XML-RPC");
             tracker.put(o, Boolean.TRUE);
@@ -292,13 +313,11 @@ class XMLRPC extends XML implements Function {
             new BufferedReader(new FilterReader(new InputStreamReader(new Filter(http.getInputStream()))) {
                 public int read() throws IOException {
                     int i = super.read();
-                    System.out.println("X " + i);
                     if (Log.on) Log.log(this, "recv: " + ((char)i));
                     return i;
                 }
                 public int read(char[] c, int off, int len) throws IOException {
                     int ret = super.read(c, off, len);
-                    System.out.println("Y " + ret);
                     if (ret == -1) return ret;
                     if (Log.on) Log.log(this, "recv: " + new String(c, off, ret));
                     return ret;