473,383 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Get values

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").Va lue
.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

Nov 9 '06 #1
1 1088
Try using a System.Xml.XPath.XPathNavigator to navigate your XmlDocument, by
using the CreateNavigator method:

http://msdn2.microsoft.com/en-us/lib...navigator.aspx

The XPathNavigator class allows you to navigate in all directions in an
XmlDocument, using XPath expressions:

http://msdn2.microsoft.com/en-us/lib...navigator.aspx

--
HTH,

Kevin Spencer
Microsoft MVP
Ministry of Software Development
http://unclechutney.blogspot.com

I just flew in from Chicago with
a man with a wooden leg named Smith
who shot an elephant in my pajamas.
So I bit him.
"shapper" <md*****@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
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").Va lue
.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

Nov 9 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Paul C-T | last post by:
Hi, Am I trying to be too clever here? I am trying to write a PHP page to enable me to enter values into a form then write those values to a text file. I want to use the form & table that...
1
by: Sue Adams | last post by:
I have a form on an asp page and am trying to write the code to place the values of all checkboxes that have been selected, into an array. The checkbox values will be used in a dynamic sql statement...
5
by: James Baker | last post by:
I have a form that has a dropdown list that will cause a post to the same page when it's changed. The problem I'm running into is that all of the controls reset to their default values (obviously...
26
by: Agoston Bejo | last post by:
I want to enforce such a constraint on a column that would ensure that the values be all unique, but this wouldn't apply to NULL values. (I.e. there may be more than one NULL value in the column.)...
4
by: Steve Hall | last post by:
Folks, My secnario involves two tables - ObservationRegister, and Person. ObservationRegister contains most of the "useful" fields, including the UserID of the person that raised the record, and...
6
by: cipher | last post by:
I have some constant values in my web service that my client application will require. Having to keep server side and client side definitions insync is tedious. I am trying to do something like...
2
by: Hennie | last post by:
I apologise if this is a stupid question, but I would appreciated any help on this subject. I want to create a view (VIEW_1 in example below) where I take numeric values from a field in one...
8
by: aleksandar.ristovski | last post by:
Hello all, I have been thinking about a possible extension to C/C++ syntax. The current syntax allows declaring a function that returns a value: int foo(); however, if I were to return...
13
by: Gregor =?UTF-8?B?S292YcSN?= | last post by:
Hi! With VALUES you can do something like: SELECT * FROM (VALUES ('A', 1), ('B', 2), ('C', 2)) AS TEMP(LETTER, NUMBER) which will give you: LETTER NUMBER ------ ------ A 1 B 2...
8
by: gigonomics | last post by:
Hi all, I hope someone can help me out. I need to return the best available seats subject to the constraint that the seats are side by side (or return X consecutive records from a table column...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.