Index of an XML Element RRS feed

  • Question

  • Hello everyone. I have a question i have been dealing with over the past week. This is an xml and wanted to get the index of the of the child second Element called Phrase.

    what am doing is, anytime i add the element to a node i want to tag the index. i know i can use xPath but I still want to tag it index instead. Remember though, i can have comments in there also below is an example of the xml

     <BeginRewardBalancePhrase name="Begin Reward Balance Phrase" description="">

            <!-- Comment -->

            <Phrase name ="" description="">Beginning Reward Balance</Phrase>

            <Phrase name="" descripton="">Begin</Phrase>



    Tuesday, April 13, 2010 1:24 AM

All replies

  • Hi,

    Use "GetElementsByTagName" method of XMLDocument class, which will return XMLNode list. Using this list tag it index.


    XmlNodeList list = document.GetElementsByTagName("Prase");


    Tuesday, May 4, 2010 5:48 AM