Jul 29, 2009

SharePoint WebService Response and XML Parsing

XML Parsing

XML Returned by WebService Call


XML Parsing

private bool IsGroupExisting(ugWebService.UserGroup ugws, ArrayList grps)
{
bool flag = false;
try
{
if (grps != null & grps.Count != 0)
{
for (int i = 0; i < grps.Count; i++)
{
//Find the groups in the SP Level and if any exists notify
System.Xml.XmlNode ndGroup = ugws.GetGroupCollectionFromWeb();
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.LoadXml(ndGroup.InnerXml);
System.Xml.XmlElement root = doc.DocumentElement;
System.Xml.XmlNodeList lst = root.GetElementsByTagName("Group");

foreach (System.Xml.XmlNode n in lst)
{
string name = n.Attributes[1].Value;
EventLogHandler.AddApplicationEventLog("IsGroupExisting Name ..." + name);
if(name.Trim().Equals(grps[i].ToString().Trim()))
{
flag = true;
break;
}//if
}//for each
if (flag)
break;

}//for
}//if
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}

No comments:

Pages