Create Entry Object from XML

5 views
Skip to first unread message

Edwin

unread,
Jul 23, 2010, 3:52:43 PM7/23/10
to Google Data APIs .NET Client Library
Hello,

I retrieved xml from a ContactEntry using the SaveToXml() Method, and
am storing it in a database. Does anybody know how I can create a
ContactEntry from the xml?

Edwin

unread,
Jul 27, 2010, 3:54:36 PM7/27/10
to Google Data APIs .NET Client Library
Update: I added the following code to the service.cs file, Service
Class and now I'm able to get a contact entry from XML.

public AtomEntry Get(string entryXML, string uriToUse)
{
AtomFeed feed = null;

if (entryXML == null)
{
throw new System.ArgumentNullException("entryXML",
"The argument MUST not be null");
}

if (uriToUse == null)
{
throw new System.ArgumentNullException("uriToUse",
"The argument MUST not be null. Any uri will be fine.");
}

byte[] xmlBytes =
System.Text.Encoding.UTF8.GetBytes(entryXML);
System.IO.MemoryStream responseStream = new
System.IO.MemoryStream(xmlBytes, 0, xmlBytes.Length);


if (responseStream != null)
{
feed = CreateAndParseFeed(responseStream, new
System.Uri(uriToUse));
}
return feed.Entries[0];
Reply all
Reply to author
Forward
0 new messages