Author: fmantek
Date: Mon Jun 25 04:24:54 2007
New Revision: 189
Modified:
trunk/clients/cs/RELEASE_NOTES.txt
trunk/clients/cs/lib/Mobile/WindowsMobile/Google.GData.AccessControl.dll.dll
trunk/clients/cs/lib/Mobile/WindowsMobile/Google.GData.Apps.dll
trunk/clients/cs/lib/Mobile/WindowsMobile/Google.GData.Calendar.dll
trunk/clients/cs/lib/Mobile/WindowsMobile/Google.GData.Client.dll
trunk/clients/cs/lib/Mobile/WindowsMobile/Google.GData.CodeSearch.dll
trunk/clients/cs/lib/Mobile/WindowsMobile/Google.GData.Extensions.dll
trunk/clients/cs/lib/Mobile/WindowsMobile/Google.GData.GoogleBase.dll
trunk/clients/cs/lib/Mobile/WindowsMobile/Google.GData.Spreadsheets.dll
trunk/clients/cs/src/gbase/gbaseattribute.cs
trunk/clients/cs/src/unittests/gbase/gbaseattributetest.cs
Log:
Added support for new Google Base attribute. Added mobile DLLs for it
Modified: trunk/clients/cs/RELEASE_NOTES.txt
==============================================================================
--- trunk/clients/cs/RELEASE_NOTES.txt (original)
+++ trunk/clients/cs/RELEASE_NOTES.txt Mon Jun 25 04:24:54 2007
@@ -1,3 +1,7 @@
+== 1.0.9.9 ==
+- added GBase support for m:adjusted_name and gm:adjusted_value inside
attributes
+ (returned only when adjustments are enabled)
+
== 1.0.9.8 ==
- fixed a parsing bug in SpreadsheetService
Modified:
trunk/clients/cs/lib/Mobile/WindowsMobile/Google.GData.AccessControl.dll.dll
==============================================================================
Binary files. No diff available.
Modified: trunk/clients/cs/lib/Mobile/WindowsMobile/Google.GData.Apps.dll
==============================================================================
Binary files. No diff available.
Modified: trunk/clients/cs/lib/Mobile/WindowsMobile/Google.GData.Calendar.dll
==============================================================================
Binary files. No diff available.
Modified: trunk/clients/cs/lib/Mobile/WindowsMobile/Google.GData.Client.dll
==============================================================================
Binary files. No diff available.
Modified: trunk/clients/cs/lib/Mobile/WindowsMobile/Google.GData.CodeSearch.dll
==============================================================================
Binary files. No diff available.
Modified: trunk/clients/cs/lib/Mobile/WindowsMobile/Google.GData.Extensions.dll
==============================================================================
Binary files. No diff available.
Modified: trunk/clients/cs/lib/Mobile/WindowsMobile/Google.GData.GoogleBase.dll
==============================================================================
Binary files. No diff available.
Modified:
trunk/clients/cs/lib/Mobile/WindowsMobile/Google.GData.Spreadsheets.dll
==============================================================================
Binary files. No diff available.
Modified: trunk/clients/cs/src/gbase/gbaseattribute.cs
==============================================================================
--- trunk/clients/cs/src/gbase/gbaseattribute.cs (original)
+++ trunk/clients/cs/src/gbase/gbaseattribute.cs Mon Jun 25 04:24:54 2007
@@ -375,6 +375,8 @@
private bool isPrivate;
/// <summary>Content, null if subElements != null.</summary>
private string content;
+ private string adjustedValue;
+ private string adjustedName;
/// <summary>Dictionary of: subElementName x subElementValue.
/// Null if content != null</summary>
@@ -482,6 +484,40 @@
}
}
+
+ ///////////////////////////////////////////////////////////////////////
+ /// <summary>A better name for this attribute, recommended by
+ /// Google (when adjustments are turned on)</summary>
+ ///////////////////////////////////////////////////////////////////////
+ public string AdjustedName
+ {
+ get
+ {
+ return adjustedName;
+ }
+ set
+ {
+ adjustedName = value;
+ }
+ }
+
+
+ ///////////////////////////////////////////////////////////////////////
+ /// <summary>A better value for this string attribute, recommended by
+ /// Google (when adjustments are turned on)</summary>
+ ///////////////////////////////////////////////////////////////////////
+ public string AdjustedValue
+ {
+ get
+ {
+ return adjustedValue;
+ }
+ set
+ {
+ adjustedValue = value;
+ }
+ }
+
//////////////////////////////////////////////////////////////////////
/// <summary>Accesses sub-elements.
///
@@ -578,20 +614,37 @@
}
attribute.IsPrivate = node.Attributes["access"] != null &&
"private".Equals(node.Attributes["access"].Value);
- bool hasSubElements = false;
foreach (XmlNode child in node.ChildNodes)
{
if (child.NodeType == XmlNodeType.Element)
{
- attribute[child.LocalName] = child.InnerXml;
- hasSubElements = true;
+ bool parsed = false;
+ if (child.NamespaceURI == GBaseNameTable.NSGBaseMeta)
+ {
+ object localName = child.LocalName;
+ if (localName.Equals("adjusted_name"))
+ {
+ attribute.AdjustedName = child.InnerText;
+ parsed = true;
+ }
+ else if (localName.Equals("adjusted_value"))
+ {
+ attribute.AdjustedValue = child.InnerText;
+ parsed = true;
+ }
+ }
+ // Keep everything else as XML
+ if (!parsed)
+ {
+ attribute[child.LocalName] = child.InnerXml;
+ }
}
}
// If there are sub-elements, set the Content to null unless
// there is clearly something in there.
string content = ExtractDirectTextChildren(node);
- if (!hasSubElements || !"".Equals(content.Trim(kXmlWhitespaces)))
+ if (!"".Equals(content.Trim(kXmlWhitespaces)))
{
attribute.Content = content;
}
@@ -631,6 +684,25 @@
{
writer.WriteAttributeString("access", "private");
}
+
+ if (adjustedValue != null)
+ {
+ writer.WriteStartElement(GBaseNameTable.GBaseMetaPrefix,
+ "adjusted_value",
+ GBaseNameTable.NSGBaseMeta);
+ writer.WriteString(adjustedValue);
+ writer.WriteEndElement();
+ }
+
+ if (adjustedName != null)
+ {
+ writer.WriteStartElement(GBaseNameTable.GBaseMetaPrefix,
+ "adjusted_name",
+ GBaseNameTable.NSGBaseMeta);
+ writer.WriteString(adjustedName);
+ writer.WriteEndElement();
+ }
+
if (content != null)
{
writer.WriteString(content);
@@ -711,6 +783,7 @@
GBaseAttribute other = o as GBaseAttribute;
return name == other.name && type == other.type &&
content == other.content && isPrivate == other.isPrivate &&
+ adjustedName == other.adjustedName && adjustedValue ==
other.adjustedValue &&
HashTablesEquals(subElements, other.subElements);
}
Modified: trunk/clients/cs/src/unittests/gbase/gbaseattributetest.cs
==============================================================================
--- trunk/clients/cs/src/unittests/gbase/gbaseattributetest.cs (original)
+++ trunk/clients/cs/src/unittests/gbase/gbaseattributetest.cs Mon Jun 25
04:24:54 2007
@@ -262,6 +262,29 @@
AssertRereadIsSame(attribute);
}
+ [Test]
+ public void ParseAdjustedNameAndValueTest()
+ {
+ GBaseAttribute attribute =
+ Parse("<?xml version='1.0'?>" +
+ "<g:hello xmlns:g='" + GBaseNameTable.NSGBase + "'
xmlns:gm='" + GBaseNameTable.NSGBaseMeta + "'>" +
+
"<gm:adjusted_name>hello2</gm:adjusted_name><gm:adjusted_value>x</gm:adjusted_value>"
+
+ "a" +
+ "</g:hello>");
+ Assert.AreEqual("hello2", attribute.AdjustedName);
+ Assert.AreEqual("x", attribute.AdjustedValue);
+ Assert.AreEqual("a", attribute.Content);
+ }
+
+ [Test]
+ public void ReReadAdjustedNameAndValueTest()
+ {
+ GBaseAttribute attribute = new GBaseAttribute("x");
+ attribute.AdjustedName = "hello";
+ attribute.AdjustedValue = "world";
+ AssertRereadIsSame(attribute);
+ }
+
private void AssertRereadIsSame(GBaseAttribute attribute)
{
StringWriter sw = new StringWriter();
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---