- try {
- NativeDate nd = (NativeDate)Context.enter().newObject(org.xwt.util.JSObject.defaultObjects, "Date");
- double date = NativeDate.date_msecFromDate(Double.valueOf(s.substring(0, 4)).doubleValue(),
- Double.valueOf(s.substring(4, 6)).doubleValue() - 1,
- Double.valueOf(s.substring(6, 8)).doubleValue(),
- Double.valueOf(s.substring(9, 11)).doubleValue(),
- Double.valueOf(s.substring(12, 14)).doubleValue(),
- Double.valueOf(s.substring(15, 17)).doubleValue(),
- (double)0
- );
- nd.jsFunction_setTime(NativeDate.internalUTC(date));
- objects.setElementAt(nd, objects.size() - 1);
-
- } catch (Exception e) {
- if (Log.on) Log.log(this, "error parsing date : " + s);
- if (Log.on) Log.log(this, e);
+ else if (c.localName.equals("name"))
+ objects.addElement(new String(content.getBuf(), 0, content.size()));
+
+ else if (c.localName.equals("value") && "".equals(objects.lastElement()))
+ objects.setElementAt(new String(content.getBuf(), 0, content.size()), objects.size() - 1);
+
+ else if (c.localName.equals("dateTime.iso8601")) {
+ String s = new String(content.getBuf(), 0, content.size());
+
+ // strip whitespace
+ int i=0;
+ while(Character.isWhitespace(s.charAt(i))) i++;
+ if (i > 0) s = s.substring(i);
+
+ try {
+ JSDate nd = new JSDate();
+ double date = JSDate.date_msecFromDate(Double.valueOf(s.substring(0, 4)).doubleValue(),
+ Double.valueOf(s.substring(4, 6)).doubleValue() - 1,
+ Double.valueOf(s.substring(6, 8)).doubleValue(),
+ Double.valueOf(s.substring(9, 11)).doubleValue(),
+ Double.valueOf(s.substring(12, 14)).doubleValue(),
+ Double.valueOf(s.substring(15, 17)).doubleValue(),
+ (double)0
+ );
+ nd.setTime(JSDate.internalUTC(date));
+ objects.setElementAt(nd, objects.size() - 1);
+
+ } catch (Exception e) {
+ if (Log.on) Log.log(this, "error parsing date : " + s);
+ if (Log.on) Log.log(this, e);
+ }
+
+ } else if (c.localName.equals("member")) {
+ Object memberValue = objects.elementAt(objects.size() - 1);
+ String memberName = (String)objects.elementAt(objects.size() - 2);
+ JS struct = (JS)objects.elementAt(objects.size() - 3);
+ struct.put(memberName, memberValue);
+ objects.setSize(objects.size() - 2);
+
+ } else if (c.localName.equals("data")) {
+ int i;
+ for(i=objects.size() - 1; objects.elementAt(i) != null; i--);
+ JSArray arr = new JSArray();
+ for(int j = i + 1; j<objects.size(); j++) arr.put(new Integer(j - i - 1), objects.elementAt(j));
+ objects.setElementAt(arr, i);
+ objects.setSize(i + 1);
+