public WebMethodsHtmlResponseObject this[string objectName]
{
get
{
if(string.IsNullOrEmpty(objectName))
throw new ArgumentException("objectName is null or empty", "objectName");
XmlNode nameNode = _Xml.FirstChild;
if (objectName.Contains(".")) // Parse dots
{
string[] objectNames = objectName.Split('.');
for (int i = 0; i < objectNames.Length; i++)
{ // Traverse each node, then sub-node, for the one we're seeking
nameNode = FindObjectNameNode(objectNames[i], nameNode.ParentNode);
if (nameNode == null)
throw new KeyNotFoundException(
string.Format("Object path {0} not found. {1} does not exist.",
objectName, objectName[i]));
}
}
else // Simple find
nameNode = FindObjectNameNode(objectName, nameNode);
if (nameNode == null)
throw new KeyNotFoundException(string.Format("{0} does not exist.", objectName));
return new WebMethodsHtmlResponseObject(nameNode.NextSibling.OuterXml);
}
}