S
shapper
Hello,
I created a XmlNodeList as follows:
Dim siteMap As XmlDocument = New XmlDocument
siteMap.Load("~/Web.sitemap")
' Get Node List using XPath
Dim siteMapNodeList As XmlNodeList =
siteMap.SelectNodes("sitemapnode[@footer='true']")
Dim siteMapNode As XmlNode
Now I want to go trough each node and get the value of "title" and
"url" attributes to use in a Bulleted List. My problem is tho get those
values
' Loop through each node in XML node list
For Each siteMapNode In siteMapNodeList
MyBulletedList.Items.Add(New
ListItem(siteMapNode.Attributes("title"),
siteMapNode.Attributes("url")))
Next
How can I do this?
Thanks,
Miguel
P.S: Here is the XML file I am using. I think my VB.Net code is well
done ... at least I hope.
<?xml version="1.0" encoding="utf-8" ?>
<siteMap
xmlns = "http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode>
<siteMapNode
url = "~/default.aspx"
description = "des"
title = "Página Inicial"
footer = "true" />
<siteMapNode
url = "~/collection.aspx"
description = "desc"
title = "Colecção"
footer = "false" />
<siteMapNode
url = "~/contacts.aspx"
description = "desc"
title = "Contactos"
footer = "true" />
</siteMapNode>
</siteMap>
I created a XmlNodeList as follows:
Dim siteMap As XmlDocument = New XmlDocument
siteMap.Load("~/Web.sitemap")
' Get Node List using XPath
Dim siteMapNodeList As XmlNodeList =
siteMap.SelectNodes("sitemapnode[@footer='true']")
Dim siteMapNode As XmlNode
Now I want to go trough each node and get the value of "title" and
"url" attributes to use in a Bulleted List. My problem is tho get those
values
' Loop through each node in XML node list
For Each siteMapNode In siteMapNodeList
MyBulletedList.Items.Add(New
ListItem(siteMapNode.Attributes("title"),
siteMapNode.Attributes("url")))
Next
How can I do this?
Thanks,
Miguel
P.S: Here is the XML file I am using. I think my VB.Net code is well
done ... at least I hope.
<?xml version="1.0" encoding="utf-8" ?>
<siteMap
xmlns = "http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode>
<siteMapNode
url = "~/default.aspx"
description = "des"
title = "Página Inicial"
footer = "true" />
<siteMapNode
url = "~/collection.aspx"
description = "desc"
title = "Colecção"
footer = "false" />
<siteMapNode
url = "~/contacts.aspx"
description = "desc"
title = "Contactos"
footer = "true" />
</siteMapNode>
</siteMap>