|
|
|
our sample XML document is as below |
Click here to copy the following block | <?xml version="1.0" encoding="utf-8" ?> <SideBar> <Panel Caption="Downloads"> <Link Text="VB" URL="LanguageCategory.aspx?SelectionId=1" /> <Link Text="VB.net" URL="LanguageCategory.aspx?SelectionId=2" /> <Link Text="C#" URL="LanguageCategory.aspx?SelectionId=3" /> <Link Text="ASP" URL="LanguageCategory.aspx?SelectionId=5" /> <Link Text="ASP.net" URL="LanguageCategory.aspx?SelectionId=4" /> <Link Text="SQL" URL="LanguageCategory.aspx?SelectionId=6" /> </Panel> <Panel Caption="Projects"> <Link Text="Textile Automation" URL="Projects.aspx?SelectionId=1" /> </Panel> <Panel Caption="Certifications"> <Link Text="MCSD.net" URL="Certifications.aspx?SelectionId=1" /> <Link Text="MCSA" URL="Certifications.aspx?SelectionId=2" /> <Link Text="MCDBA" URL="Certifications.aspx?SelectionId=3" /> <Link Text="MCSE" URL="Certifications.aspx?SelectionId=4" /> </Panel> <Panel Caption="Links"> <Link Text="VB Links" URL="Links.aspx?SelectionId=1" /> <Link Text="VB.net Links" URL="Links.aspx?SelectionId=2" /> <Link Text="SQL Links" URL="Links.aspx?SelectionId=3" /> <Link Text="ASP.net Links" URL="Links.aspx?SelectionId=4" /> </Panel> <Panel Caption="About Me"> <Link Text="My Job" URL="AboutMe.aspx?SelectionId=1" /> <Link Text="My Friends" URL="AboutMe.aspx?SelectionId=2" /> <Link Text="My Family" URL="AboutMe.aspx?SelectionId=3" /> <Link Text="My Hobby" URL="AboutMe.aspx?SelectionId=4" /> </Panel> <Panel Caption="Photo Galary"> <Link Text="College Time" URL="PhotoGalary.aspx?SelectionId=1" /> <Link Text="Richmond Function" URL="PhotoGalary.aspx?SelectionId=2" /> <Link Text="Family Photos" URL="PhotoGalary.aspx?SelectionId=3" /> <Link Text="Other" URL="PhotoGalary.aspx?SelectionId=4" /> </Panel> </SideBar> |
We will use following function to find specific panel data. |
Click here to copy the following block | Function ParseXML(ByVal XMLFilePath As String, ByVal PanelCaption As String) Dim xDoc As New XPathDocument(XMLFilePath) Dim xNav As XPathNavigator = xDoc.CreateNavigator()
Dim xIterator As XPathNodeIterator = xNav.Select("/SideBar/Panel[@Caption=""" & PanelCaption & """]/Link")
While xIterator.MoveNext()
Console.WriteLine(xIterator.Current.GetAttribute("Text", "")) Console.WriteLine(xIterator.Current.GetAttribute("URL", "")) End While End Function |
we can call this function as following |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|