<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
<response uri=\"/crm/private/xml/Potentials/updateRecords\">
<result>
<message>***TEST***Record(s) updated successfully</message>
<recorddetail>
<FL val=\"Id\">414100000000000000</FL>
<FL val=\"Created Time\">2012-03-30 16:54:03</FL>
<FL val=\"Modified Time\">2012-04-11 16:53:48</FL>
<FL val=\"Created By\"><![CDATA[Bayer]]></FL>
<FL val=\"Modified By\"><![CDATA[Bayer]]></FL>
</recorddetail>
</result>
</response>
This is a generic response from Zoho stating that my record was updated successfully (minus the test part and the bogus ZohoID.) I have been trying to get my C# program to be able to make that style of xml document because when i post things to zoho it actually is very similar in style. But i just can't figure out how to make it work This is an example from their website.
<Leads>
<row no="1">
<FL val="Lead Source">Web Download</FL>
<FL val="First Name">contacto 1</FL>
<FL val="Last Name">apellido</FL>
<FL val="Email">[email protected]</FL>
<FL val="Title">Manager</FL>
<FL val="Phone">1234567890</FL>
<FL val="Home Phone">0987654321</FL>
<FL val="Other Phone">1212211212</FL>
<FL val="Fax">02927272626</FL>
<FL val="Mobile">292827622</FL>
</row>
</Leads>
I am trying to replicate it using a unit test in C#, but it gives me errors of all kinds.. i've lost all the different ways that i've tried, but i'll post what i currently have and the error it is throwing.
[Test]
public void TestMethod()
{
XmlDocument doc = new XmlDocument();
XmlDeclaration declare = doc.CreateXmlDeclaration("1.0", null, null);
doc.AppendChild(declare);
doc.AppendChild(doc.CreateElement("Potentials"));
doc.AppendChild(doc.CreateAttribute("FL", "AccountName", "Robert Snyder"));
doc.Save("C:\\test.xml");
//doc.WriteContentTo(XmlWriter.Create("C:\\test.xml"));
}
Exception
System.InvalidOperationException : The specified node cannot be inserted as the valid child of this node, because the specified node is the wrong type. - c:\Subversion\ZohoApi\ZohoApi\Tests\XmlDataTests.cs:22
Please help me understand this a little better. I have been trying for a long time, and just can't figure it out.
In order to make the following output
copy use this code and run it in a unit test.