S
shapper
Hello,
I am trying to load information from a XML file using only the nodes
which attribute footer=true.
I created the following code:
Dim siteMap As New System.Xml.XmlDocument
siteMap.Load(HttpContext.Current.Server.MapPath(Me.SiteMapUrl))
Dim siteMapNodeList As XmlNodeList =
siteMap.SelectNodes("sitemapnode[@footer='true']")
Dim iSiteMapNode As Integer
' Loop through each node in XML node list
For iSiteMapNode = 0 To siteMapNodeList.Count - 1
' Create new hyperlink
Dim link As New HyperLink
' Define hyperlink properties
With link
.ID = "by27f_h" &
siteMapNodeList(iSiteMapNode).Attributes("title").Value
.NavigateUrl =
siteMapNodeList(iSiteMapNode).Attributes("url").Value
.Text =
siteMapNodeList(iSiteMapNode).Attributes("title").Value
.ToolTip =
siteMapNodeList(iSiteMapNode).Attributes("title").Value
End With
Next
I am not getting anything.
My XML file is as follows:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap
xmlns = "http://schemas.microsoft.com/ASPNet/SiteMap-File-1.0" >
<siteMapNode>
<siteMapNode
url = "~/Default.ASPx"
title = "Home"
description = "Desc1"
footer = "true" />
<siteMapNode
url = "~/Contacts.ASPx"
title = "Contactos"
description = "Desc2"
footer = "true" />
</siteMapNode>
</siteMap>
Could you tell me what am I doing wrong?
I can't understand why I don't get any values.
Thanks,
Miguel
I am trying to load information from a XML file using only the nodes
which attribute footer=true.
I created the following code:
Dim siteMap As New System.Xml.XmlDocument
siteMap.Load(HttpContext.Current.Server.MapPath(Me.SiteMapUrl))
Dim siteMapNodeList As XmlNodeList =
siteMap.SelectNodes("sitemapnode[@footer='true']")
Dim iSiteMapNode As Integer
' Loop through each node in XML node list
For iSiteMapNode = 0 To siteMapNodeList.Count - 1
' Create new hyperlink
Dim link As New HyperLink
' Define hyperlink properties
With link
.ID = "by27f_h" &
siteMapNodeList(iSiteMapNode).Attributes("title").Value
.NavigateUrl =
siteMapNodeList(iSiteMapNode).Attributes("url").Value
.Text =
siteMapNodeList(iSiteMapNode).Attributes("title").Value
.ToolTip =
siteMapNodeList(iSiteMapNode).Attributes("title").Value
End With
Next
I am not getting anything.
My XML file is as follows:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap
xmlns = "http://schemas.microsoft.com/ASPNet/SiteMap-File-1.0" >
<siteMapNode>
<siteMapNode
url = "~/Default.ASPx"
title = "Home"
description = "Desc1"
footer = "true" />
<siteMapNode
url = "~/Contacts.ASPx"
title = "Contactos"
description = "Desc2"
footer = "true" />
</siteMapNode>
</siteMap>
Could you tell me what am I doing wrong?
I can't understand why I don't get any values.
Thanks,
Miguel