Hi,

I've been faced a parsing error exception when loading an event feed
xml which
have been stored locally by EventFeed.SaveToXML().

After some investigation I found it possibly is a bug, at gextension/
comments.cs:67 (v1.1.1.0).


[problem]

In a locally saved EventFeed xml with EventFeed.SaveToXml(FileStream),
there are <gd:comments> elements in each event entry like:

|  <entry>
|    <gd:comments>
|      <gd:feedLink href="http://www.google.com/.../comments"; />
|    </gd:comments>

And the original parser code is:

|            object localname = node.LocalName;
|            if
(localname.Equals(GDataParserNameTable.XmlCommentsElement))
|            {
|                comments = new Comments();
|                if (node.HasChildNodes)
|                {
|                    XmlNode commentsChild = node.FirstChild;
|                    while (commentsChild != null && commentsChild is
XmlElement)
|                    {

But the it never enters into the last while loop because the
`commentsChild' is firstly
WhiteSpace class but not XmlElement (placed between
<gd:comments>~<gd:feedLink> in the xml).


[fixing]

diff -c src/extensions/comments.cs src/extensions/comments.cs.new
*** src/extensions/comments.cs          Thu Sep  3 14:12:10 2007
--- src/extensions/comments.cs.new      Thu Nov  8 20:01:24 2007
***************
*** 64,81 ****
                  if (node.HasChildNodes)
                  {
                      XmlNode commentsChild = node.FirstChild;
!                     while (commentsChild != null && commentsChild is
XmlElement)
!                     {
!                         if (commentsChild.LocalName ==
GDataParserNameTable.XmlFeedLinkElement &&
!                             commentsChild.NamespaceURI ==
BaseNameTable.gNamespace)
!                         {
!                             if (comments.FeedLink == null)
!                             {
!                                 comments.FeedLink =
FeedLink.ParseFeedLink(commentsChild);
!                             }
!                             else
!                             {
!                                 throw new ArgumentException("Only
one feedLink is allowed inside the gd:comments");
                              }
                          }
                          commentsChild = commentsChild.NextSibling;
--- 64,78 ----
                  if (node.HasChildNodes)
                  {
                      XmlNode commentsChild = node.FirstChild;
!                     while (commentsChild != null) {
!                         if (commentsChild is XmlElement) {
!                             if (commentsChild.LocalName ==
GDataParserNameTable.XmlFeedLinkElement &&
!                                 commentsChild.NamespaceURI ==
BaseNameTable.gNamespace) {
!                                 if (comments.FeedLink == null) {
!                                     comments.FeedLink =
FeedLink.ParseFeedLink(commentsChild);
!                                 } else {
!                                     throw new
ArgumentException("Only one feedLink is allowed inside the
gd:comments");
!                                 }
                              }
                          }
                          commentsChild = commentsChild.NextSibling;


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Calendar Data API" group.
To post to this group, send email to 
[email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to