C# navigating to top of page
-
Hello, I'm trying to navigate from the middle of the xml page back to the top(to the parent node). So I can perform another search looking for matches to my random number,
while (xmlReader.Read()) //while loop to verify the new number is unique
{xmlReader.MoveToElement(); TempNo = xmlReader.Value; if (tempNo == Convert.ToString(userID)) { //if already exist, create new one UserID = RadNo.Next(10, 99); //Random number //At this point I want to start searching again //Move to the top of the parent node (1st node on page) //and search all nodes again. } }
The above is my code, hope this help. Sorry if this is a simple question, I'm totally new to xml and c# just learning it really... -JC
-
Hello, I'm trying to navigate from the middle of the xml page back to the top(to the parent node). So I can perform another search looking for matches to my random number,
while (xmlReader.Read()) //while loop to verify the new number is unique
{xmlReader.MoveToElement(); TempNo = xmlReader.Value; if (tempNo == Convert.ToString(userID)) { //if already exist, create new one UserID = RadNo.Next(10, 99); //Random number //At this point I want to start searching again //Move to the top of the parent node (1st node on page) //and search all nodes again. } }
The above is my code, hope this help. Sorry if this is a simple question, I'm totally new to xml and c# just learning it really... -JC
XMLReader
is forward only. UseXMLDocument
class instead and useXPath
to do your search.All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions