[icalendar] icalendar XML issues

Cyrus Harmon <cyrus@bobobeach.com> Sat, 14 April 2012 15:01 UTC

Return-Path: <cyrus@bobobeach.com>
X-Original-To: icalendar@ietfa.amsl.com
Delivered-To: icalendar@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id A070421F8642 for <icalendar@ietfa.amsl.com>; Sat, 14 Apr 2012 08:01:50 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.399
X-Spam-Level:
X-Spam-Status: No, score=-1.399 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, J_CHICKENPOX_36=0.6, J_CHICKENPOX_37=0.6]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AGtLYPR62cWV for <icalendar@ietfa.amsl.com>; Sat, 14 Apr 2012 08:01:49 -0700 (PDT)
Received: from mail.cyrusharmon.org (mail.cyrusharmon.org [206.125.171.163]) by ietfa.amsl.com (Postfix) with ESMTP id D3E6221F863E for <icalendar@ietf.org>; Sat, 14 Apr 2012 08:01:49 -0700 (PDT)
Received: from mail.cyrusharmon.org (localhost [127.0.0.1]) by mail.cyrusharmon.org (Postfix) with ESMTP id A06D22E05A for <icalendar@ietf.org>; Sat, 14 Apr 2012 08:01:43 -0700 (PDT)
Received: from [192.168.1.102] (99-28-161-110.lightspeed.miamfl.sbcglobal.net [99.28.161.110]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client did not present a certificate) by mail.cyrusharmon.org (Postfix) with ESMTP id 4542F2E059 for <icalendar@ietf.org>; Sat, 14 Apr 2012 08:01:43 -0700 (PDT)
From: Cyrus Harmon <cyrus@bobobeach.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Date: Sat, 14 Apr 2012 08:01:48 -0700
Message-Id: <B72A49DB-D74F-429D-A8D1-78705D366091@bobobeach.com>
To: icalendar@ietf.org
Mime-Version: 1.0 (Apple Message framework v1257)
X-Mailer: Apple Mail (2.1257)
X-Virus-Scanned: ClamAV using ClamSMTP
Subject: [icalendar] icalendar XML issues
X-BeenThere: icalendar@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: iCalendar <icalendar.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/icalendar>, <mailto:icalendar-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/icalendar>
List-Post: <mailto:icalendar@ietf.org>
List-Help: <mailto:icalendar-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/icalendar>, <mailto:icalendar-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sat, 14 Apr 2012 15:01:50 -0000

Hello icalendar folks,

I've been working on an iCalendar/VCARD parsing library and have run across some issues (not covered by the existing errata) in the Relax NG spec in <http://tools.ietf.org/html/rfc632>.

1. T in patttern-duration and lack of operator precedence.

My reading of <http://www.w3.org/TR/xmlschema11-2/#regexs>, and of section 3.3.6, and of section 2 of <http://relaxng.org/compact-20021121.html> suggests that the given definition of duration is wrong:

> # 3.3.6 DURATION
> 
> pattern-duration = xsd:string {
>     pattern = "(+|-)?P(\d+W)|(\d+D)?"
>             ~ "(T(\d+H(\d+M)?(\d+S)?)|"
>             ~   "(\d+M(\d+S)?)|"
>             ~   "(\d+S))?"
> }

I think the T needs to be explicitly grouped around the three HMS/MS/S forms as follows (and, also, the + character needs to be explicitly escaped, assuming that allows for specification of +P3W, e.g.): 

> @@ -221,10 +221,10 @@ value-date-time = element date-time {
>  # 3.3.6 DURATION
>  
>  pattern-duration = xsd:string {
> -    pattern = "(+|-)?P(\d+W)|(\d+D)?"
> -            ~ "(T(\d+H(\d+M)?(\d+S)?)|"
> -            ~   "(\d+M(\d+S)?)|"
> -            ~   "(\d+S))?"
> +    pattern = "(\+|-)?P((\d+W)|(\d+D))?"
> +            ~ "(T((\d+H(\d+M)?(\d+S)?)|"
> +            ~    "(\d+M(\d+S)?)|"
> +            ~    "(\d+S)))?"
>  }
>  
>  value-duration = element duration {

FWIW, perl's regex syntax accepts the former definition, but only applies to the T to the HMS form.

2. type-date, type-date-time?

I only see single references to type-date and type-date-time. 

> type-until = element until {
>     type-date |
>     type-date-time
> }
> 

Perhaps those should be value-date and value-date-time?

> @@ -290,8 +290,8 @@ type-freq = element freq {
>  }
>  
>  type-until = element until {
> -    type-date |
> -    type-date-time
> +    value-date |
> +    value-date-time
>  }
>  
>  type-count = element count {
> 


3. Bogus Grammar/regex

As discussed in the email message here: <http://lists.common-lisp.net/pipermail/cxml-devel/2012-March/000553.html>

> type-byday = element byday {
>    xsd:integer?,
>    type-weekday
> }

This mixing of grammar and regex matching in the same node isn't allowed.

> @@ -321,8 +321,7 @@ type-weekday = (
>  )
>  
>  type-byday = element byday {
> -    xsd:integer?,
> -    type-weekday
> +    xsd:string { pattern='-?[0-9]+(SU|MO|TU|WE|TH|FR|SA)' }
>  }
>  
>  type-bymonthday = element bymonthday {
> 

Fixes the problem.

4. The following plus needs to be explicitly escaped:

> @@ -370,7 +369,7 @@ value-uri = element uri {
>  # 3.3.14 UTC-OFFSET
>  
>  value-utc-offset = element utc-offset {
> -    xsd:string { pattern = "(+|-)\d\d:\d\d(:\d\d)?" }
> +    xsd:string { pattern = "(\+|-)\d\d:\d\d(:\d\d)?" }
>  }
>  
>  # UNKNOWN
> 


5. tzuurl is a typo, it should be tzurl. And, while we're at it, the lack of operator precedence rears it's ugly head again below and can't that be written more simply as follows:

> @@ -567,12 +566,10 @@ component-vtimezone = element vtimezone {
>          property-tzid &
>  
>          property-last-mod? &
> -        property-tzuurl?
> +        property-tzurl?
>      },
>      element components {
> -        (component-standard | component-daylight) &
> -        component-standard* &
> -        component-daylight*
> +        (component-standard | component-daylight )+
>      }
>  }
> 

6. Lack of operator precedence rears its ugly head again in property-attach.

> @@ -684,7 +681,7 @@ property-attach = element attach {
>          encodingparam?
>      }?,
>  
> -    value-uri | value-binary
> +    ( value-uri | value-binary )
>  }
>  
>  # 3.8.1.2 Categories
> 

7. In property-categories, there is a bogus & -- there's nothing to interleave!

> @@ -692,7 +689,7 @@ property-attach = element attach {
>  property-categories = element categories {
>  
>      element parameters {
> -        languageparam? &
> +        languageparam?
>      }?,
>  
>      value-text+
> 

8. More lack of operator precedence problems. The following all need explicit grouping of value-date-time and value-date:

> @@ -855,8 +852,7 @@ property-dtend = element dtend {
>          tzidparam?
>      }?,
>  
> -    value-date-time |
> -    value-date
> +    ( value-date-time | value-date )
>  }
>  
>  # 3.8.2.3 Date/Time Due
> @@ -867,8 +863,7 @@ property-due = element due {
>          tzidparam?
>      }?,
>  
> -    value-date-time |
> -    value-date
> +    ( value-date-time | value-date )
>  }
>  
>  # 3.8.2.4 Date/Time Start
> @@ -879,8 +874,7 @@ property-dtstart = element dtstart {
>          tzidparam?
>      }?,
>  
> -    value-date-time |
> -    value-date
> +    ( value-date-time | value-date )
>  }
>  
>  # 3.8.2.5 Duration
> @@ -1023,8 +1017,7 @@ property-recurid = element recurrence-id {
>          rangeparam?
>      }?,
>  
> -    value-date-time |
> -    value-date
> +    ( value-date-time | value-date )
>  }
>  
>  # 3.8.4.5 Related-To
> @@ -1066,8 +1059,7 @@ property-exdate = element exdate {
>          tzidparam?
>      }?,
>  
> -    value-date-time+ |
> -    value-date+
> +    ( value-date-time | value-date)+
>  }
>  
>  # 3.8.5.2 Recurrence Date/Times
> 

9. One more grouping -- finally, property-rdate needs value-date-time, value-date and value-period grouped:

> @@ -1078,9 +1070,9 @@ property-rdate = element rdate {
>          tzidparam?
>      }?,
>  
> -    value-date-time+ |
> -    value-date+ |
> -    value-period+
> +    ( value-date-time |
> +    value-date |
> +    value-period )+
>  }
>  
>  # 3.8.5.3 Recurrence Rule
> 


I hope this is the right place to bring these issues up. I'm happy to submit errata if that's the right thing to do. The final (?) RNC schema can be found here: <https://github.com/slyrus/soiree/blob/master/icalendar-2.0.rnc>.

Thanks for all of the work on the iCalendar XML spec,

Cyrus