Sample code
static void Main(string[] args)
{
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.LoadXml("<data><option>this is test 1</option>" +
"<option>this is test 11</option><option>this is test 111</option>" +
"<option>this is test 1111</option><option>this is test 11111</option>" +
"</data>");
int pos = 0;
foreach (System.Xml.XmlElement e in doc.DocumentElement.SelectNodes("option"))
{
if (e.InnerText.Length > pos)
{
pos = e.InnerText.Length;
}
}
}
Hope this helps,
Randy
http://www.kbcafe.com
"Keith Chadwick" <kc*******@leewardsystems.com> wrote in message news:<uk**************@TK2MSFTNGP12.phx.gbl>...
XML
<data>
<option>this is test 1</option>
<option>this is test 11</option>
<option>this is test 111</option>
<option>this is test 1111</option>
<option>this is test 11111</option>
</data>
The 5 option has the longest content. I need to get that length and place
in a variable. The test has to look across all of the option nodes and
return the longest one.
Any suggestions?
Cheers
Keith