Author: fmantek
Date: Thu Sep 20 00:20:05 2007
New Revision: 261
Modified:
trunk/clients/cs/src/extensions/who.cs
Log:
partial change to fix the who element
Modified: trunk/clients/cs/src/extensions/who.cs
==============================================================================
--- trunk/clients/cs/src/extensions/who.cs (original)
+++ trunk/clients/cs/src/extensions/who.cs Thu Sep 20 00:20:05 2007
@@ -27,7 +27,7 @@
/// GData schema extension describing a person.
/// It contains a gd:entryLink element containing the described person.
/// </summary>
- public class Who : IExtensionElement
+ public class Who : IExtensionElement, IExtensionElementFactory
{
/// <summary>
@@ -231,34 +231,37 @@
#endregion
- #region Who Parser
+ #region overloaded from IExtensionElementFactory
//////////////////////////////////////////////////////////////////////
- /// <summary>Parses an xml node to create a Who object.</summary>
- /// <param name="node">Who node</param>
- /// <param name="parser">AtomFeedParser to use</param>
- /// <returns>the created Who object</returns>
+ /// <summary>Parses an xml node to create a Where object.</summary>
+ /// <param name="node">the node to parse node</param>
+ /// <returns>the created Where object</returns>
//////////////////////////////////////////////////////////////////////
- public static Who ParseWho(XmlNode node, AtomFeedParser parser)
+ public IExtensionElement CreateInstance(XmlNode node, AtomFeedParser
parser)
{
Tracing.TraceCall();
Who who = null;
- Tracing.Assert(node != null, "node should not be null");
- if (node == null)
+
+ if (node != null)
{
- throw new ArgumentNullException("node");
+ object localname = node.LocalName;
+ if (localname.Equals(this.XmlName) == false ||
+ node.NamespaceURI.Equals(this.XmlNameSpace) == false)
+ {
+ return null;
+ }
}
- object localname = node.LocalName;
- if (localname.Equals(GDataParserNameTable.XmlWhoElement))
+ who = new Who();
+ if (node != null)
{
- who = new Who();
if (node.Attributes != null)
{
if (node.Attributes[GDataParserNameTable.XmlAttributeRel]
!= null)
{
who.Rel =
node.Attributes[GDataParserNameTable.XmlAttributeRel].Value;
}
-
+
if
(node.Attributes[GDataParserNameTable.XmlAttributeValueString] != null)
{
who.valueString =
node.Attributes[GDataParserNameTable.XmlAttributeValueString].Value;
@@ -268,13 +271,13 @@
who.email =
node.Attributes[GDataParserNameTable.XmlAttributeEmail].Value;
}
}
-
+
if (node.HasChildNodes)
{
XmlNode childNode = node.FirstChild;
while (childNode != null && childNode is XmlElement)
{
-
+
if (childNode.LocalName ==
GDataParserNameTable.XmlAttendeeTypeElement)
{
who.Attendee_Type = AttendeeType.parse(childNode);
@@ -291,20 +294,37 @@
}
}
}
-
return who;
}
- #endregion
-
- #region overloaded for persistence
//////////////////////////////////////////////////////////////////////
/// <summary>Returns the constant representing this XML
element.</summary>
//////////////////////////////////////////////////////////////////////
public string XmlName
{
- get { return GDataParserNameTable.XmlWhoElement; }
+ get { return GDataParserNameTable.XmlWhereElement; }
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ /// <summary>Returns the constant representing this XML
element.</summary>
+ //////////////////////////////////////////////////////////////////////
+ public string XmlNameSpace
+ {
+ get { return BaseNameTable.gNamespace; }
}
+
+ //////////////////////////////////////////////////////////////////////
+ /// <summary>Returns the constant representing this XML
element.</summary>
+ //////////////////////////////////////////////////////////////////////
+ public string XmlPrefix
+ {
+ get { return BaseNameTable.gDataPrefix; }
+ }
+
+ #endregion
+
+
+ #region overloaded for persistence
/// <summary>
/// Persistence method for the Who object
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google 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-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---