raviprakashg Posted February 7, 2007 Share Posted February 7, 2007 Dear FriendsThis is My XML file <?xml version="1.0" encoding="utf-8" ?><rootLevel><Table> <Level id ="1"> 1 <Link Id ="HomePage.aspx">Home</Link> <Link id ="PlaceOrder.aspx"> Order Entry</Link> <Link id ="OrderStatus.aspx">Order Status</Link> <Link id ="My Task.aspx">My Task</Link> </Level></Table><Table> <Level id ="2"> 2 <Link Id ="HomePage.aspx">Home</Link> <Link id ="PlaceOrder.aspx"> Order Entry</Link> <Link id ="My Task.aspx">My Task</Link> </Level></Table><Table> <Level id ="3"> 3 <Link Id ="HomePage.aspx">Home</Link> <Link id ="My Task.aspx">My Task</Link> </Level><Table><Table> <Level id="4"> 4 <Link id ="Logout.aspx"> Logout</Link> </Level> </Table></rootLevel> Now what i want to do is, i have to take Only the Set of Information Under the Level 1 If my QueryString Passes Value 1, and i use Datarepeter to display the set of Infortmation in that i Use HyperLink, So Shall i have to take the ID of <Link> as URL to NavigateUr Help is highly needthanx in Adv.ursRaviprakashg Link to comment Share on other sites More sharing options...
jesh Posted February 7, 2007 Share Posted February 7, 2007 Hmm, I've only had to work with XML files in .NET once, so this may not be the best solution. This is how I did it:First, make sure these are referenced: using System.Data;using System.IO; Here's the code I used. You might have to tweak it but I hope it gets you headed in the right direction. DataSet ds = new DataSet();// First, get the XML data as a Stream. You could get the stream using the File class, // I'm sure, but my data was in memory already, so I used this:byte[] xml = Encoding.UTF8.GetBytes(xmlData);Stream xmlstream = new MemoryStream(xml);// Next step, load the DataSetds.ReadXml(xmlstream);// Your DataSet now has a series of DataTables, one for each element type.// ds.Tables["Table"]// ds.Tables["Level"]// ds.Tables["Link"]// To get the DataRow in the "Level" DataTable that has an ID of 3, // you might try something like this:DataView view = new DataView(ds.Tables["Level"], "id = 3", "", DataViewRowState.CurrentRows); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now