diff options
author | James Lal <james@lightsofapollo.com> | 2012-07-07 09:00:49 -0700 |
---|---|---|
committer | James Lal <james@lightsofapollo.com> | 2012-07-07 09:00:49 -0700 |
commit | a3f59b6298d87c3a72c167142546a816b3f2e73d (patch) | |
tree | c7b1d138a2c766ca6fc50093a75e74743c16a2b8 /lib/caldav/sax/dav_response.js | |
parent | 0541668eaa804770d51e85037c21887c045642c7 (diff) | |
download | jsCalDAV-a3f59b6298d87c3a72c167142546a816b3f2e73d.tar.gz |
More complete parsing of calendar data
Diffstat (limited to 'lib/caldav/sax/dav_response.js')
-rw-r--r-- | lib/caldav/sax/dav_response.js | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/lib/caldav/sax/dav_response.js b/lib/caldav/sax/dav_response.js index 0d9fb7c..dddd40b 100644 --- a/lib/caldav/sax/dav_response.js +++ b/lib/caldav/sax/dav_response.js @@ -43,11 +43,6 @@ var HrefHandler = Base.create({ name: 'href', - //don't add text only elements - //to the stack as objects - onopentag: null, - onclosetag: null, - onopentag: function() { if (this.currentTag.handler === this.handler) { this.stack.push(this.current); @@ -90,6 +85,38 @@ } }); + var PrivilegeSet = Base.create({ + name: 'PrivilegeSet', + + name: 'href', + + onopentag: function(data) { + if (this.currentTag.handler === this.handler) { + this.stack.push(this.current); + this.current = []; + } else { + if (data.tagSpec !== 'DAV:/privilege') { + this.current.push(data.local); + } + } + }, + + onclosetag: function(data) { + var current = this.currentTag; + var data; + + if (current.handler === this.handler) { + data = this.current; + + this.current = this.stack.pop(); + this.current[current.local] = data; + } + }, + + ontext: null + + }); + var ArrayHandler = Base.create({ name: 'array', @@ -124,14 +151,20 @@ handles: { 'DAV:/href': TextHandler, + 'http://calendarserver.org/ns//getctag': TextHandler, 'DAV:/status': HttpStatusHandler, 'DAV:/resourcetype': ArrayHandler, + 'DAV:/current-user-privilege-set': PrivilegeSet, 'DAV:/principal-URL': HrefHandler, 'DAV:/current-user-principal': HrefHandler, 'urn:ietf:params:xml:ns:caldav/calendar-data': CalendarDataHandler, 'DAV:/value': TextHandler, + 'DAV:/owner': HrefHandler, + 'DAV:/displayname': TextHandler, 'urn:ietf:params:xml:ns:caldav/calendar-home-set': HrefHandler, - 'urn:ietf:params:xml:ns:caldav/calendar-user-address-set': HrefHandler + 'urn:ietf:params:xml:ns:caldav/calendar-timezone': TextHandler, + 'http://apple.com/ns/ical//calendar-color': TextHandler, + 'urn:ietf:params:xml:ns:caldav/calendar-description': TextHandler }, onopentag: function(data, handler) { |