Closed Bug 707231 Opened 13 years ago Closed 13 years ago

XML parsing code does not find attributes with namespace which hinders creating events with Cosmo as CalDAV server

Categories

(Calendar :: Provider: CalDAV, defect)

Lightning 1.1
x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 605378

People

(Reporter: sfleiter, Unassigned)

Details

With Thunderbird 9 Beta (20111130015651), Lightning 1.1pre
and Cosmo as CalDAV server I could not add events to my cosmo calendar.

I debugged that and found the cause of that in the XML parsing
used in Lightning.

The CalDAV server (Cosmo) sends the following XML
as part of a PROPFIND response:

<C:supported-calendar-component-set xmlns:C="urn:ietf:params:xml:ns:caldav">
  <C:comp C:name="VAVAILABILITY"/>
  <C:comp C:name="VJOURNAL"/>
  <C:comp C:name="VEVENT"/>
  <C:comp C:name="VFREEBUSY"/>
  <C:comp C:name="VTODO"/>
</C:supported-calendar-component-set>


In calDavCalendar.js of Lightning the following code is used to parse that:

    if (supportedComponentsXml.C::comp.length() > 0) {
        thisCalendar.mSupportedItemTypes.length = 0;
        for each (let sc in supportedComponentsXml.C::comp) {

            let comp = sc.@name.toString(); // XXX

            if (thisCalendar.mGenerallySupportedItemTypes.indexOf(comp) >= 0) {
                cal.LOG("Adding supported item: " + comp + " for calendar: " + thisCalendar.name);
                thisCalendar.mSupportedItemTypes.push(comp);
            }
       }
    }

At the line marked above with XXX "comp" is empty every time.
If I patch Cosmo not to include the namespace in the "name" attribute
everything works as expected.

To make it even more clear, the following XML is parsed correctly:
<C:supported-calendar-component-set xmlns:C="urn:ietf:params:xml:ns:caldav">
  <C:comp name="VAVAILABILITY"/>
  <C:comp name="VJOURNAL"/>
  <C:comp name="VEVENT"/>
  <C:comp name="VFREEBUSY"/>
  <C:comp name="VTODO"/>
</C:supported-calendar-component-set>


According to "xmllint --debug" which dumps a debug tree of the in-memory document
the C namespace prefix for the attribute is valid but redundant, so both kinds
of writing the "name" attribute should work.
Yeah, searched for "XML" and "namespace", but none of the results matched.
This bug is not Chandler specific since the result is valid XML and other servers could do that, too.

Where do I find the documentation to the XML parsing done here:
   let comp = sc.@name.toString();
?
I would very much like to understand that code.
Thanks in advance.

If sc is in the namespace C, shouldn't sc.@name match
to name attributes in namespace C?
C:name and name are equivalent so the parsing code should handle that.
My guess is that
   sc.@*::name.toString();
matches to name attributes in any namespace which would be wrong.
Thanks for your detailed analysis Stefan Fleiter.
Thanks for the dupe Stefan Sitter.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
Component: General → Provider: CalDAV
QA Contact: general → caldav-provider
Version: unspecified → Lightning 1.1
You need to log in before you can comment on or make changes to this bug.