Sample code
static void Main(string[] args)
{
System.Xml.XmlD ocument doc = new System.Xml.XmlD ocument();
doc.LoadXml("<d ata><option>thi s is test 1</option>" +
"<option>th is is test 11</option><option> this is test 111</option>" +
"<option>th is is test 1111</option><option> this is test 11111</option>" +
"</data>");
int pos = 0;
foreach (System.Xml.Xml Element e in doc.DocumentEle ment.SelectNode s("option"))
{
if (e.InnerText.Le ngth > pos)
{
pos = e.InnerText.Len gth;
}
}
}
Hope this helps,
Randy
http://www.kbcafe.com
"Keith Chadwick" <kc*******@leew ardsystems.com> wrote in message news:<uk******* *******@TK2MSFT NGP12.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