473,320 Members | 1,990 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,320 software developers and data experts.

Beginners-problem with xpath filter and XML

Hello all,
I am building a personal web site in VS2005 as a kind of learing
project for myself, so forgive me if this is a novice question.

I am planning to use an XML file called SiteSettings.xml to hold
site-wide info such as copyright info, site title (e.g. my homepage)
etc. Currently this xml file looks like this:

<?xml version="1.0"?>
<SiteSettings>
<Settings Name="TitleText">
<value>My homepage</value>
</Settings>
</SiteSettings>

U use a datalist and a xmldatasource to display the data. The
xmldatasource lets me supply an xpath filter to display only the data I
want. As Im planning to expand this xml-file as I add more site
settings, I need an xpath that displays only the correct data. I am
trying to build an xpath that simply returns "My homepage" without the
node name or anything, but I am having a hard time making it work -
either it includes the "value" or simply doesn't show up at all..

If anybody has any inputs to either how to construct my Xpath or maybe
if I should go with another XML structure, I would gratly appreciate
it.

Trond Hindenes
Novice vb.net programmer
Norway

Nov 12 '05 #1
2 2276
Hello!
<?xml version="1.0"?>
<SiteSettings>
<Settings Name="TitleText">
<value>My homepage</value>
</Settings>
</SiteSettings>

U use a datalist and a xmldatasource to display the data. The
xmldatasource lets me supply an xpath filter to display only the data I
want. As Im planning to expand this xml-file as I add more site
settings, I need an xpath that displays only the correct data. I am
trying to build an xpath that simply returns "My homepage" without the
node name or anything, but I am having a hard time making it work -
either it includes the "value" or simply doesn't show up at all..


Try this:

/SiteSettings/Settings[@Name = 'TitleText']/value/text()
--
Pascal Schmitt
Nov 12 '05 #2
Works like a charm, thanks a lot!!

BTW, when looking at my code, I see that vistual studio adds the text
"Value:" before the actual content in the xpath query, so i wasn't way
off :-)

thanks again,

best regerds,
Trond Hindenes
Norway

Nov 12 '05 #3

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

Similar topics

2
by: P.Hill | last post by:
I was just trying to install Apache and php on an XP box for test of a PHP website I built last year. It was my first and only, so I am now rusty about the little I did learn last year. I get...
0
by: Jeff Wagner | last post by:
I found an excellent tutorial at the following location. I found it very helpful and a good refresher for some things I had forgottent ... thought I'd share this with other beginners. ...
7
by: Will | last post by:
Pardon two post in a row to the newsgroup but I want to try and expedite this, if you guys don't mind helping out... I running Windows XP Pro and wanted to download Python and any additional...
38
by: BORT | last post by:
Please forgive me if this is TOO newbie-ish. I am toying with the idea of teaching my ten year old a little about programming. I started my search with something like "best FREE programming...
4
by: blah | last post by:
I m actually a Novice in Python as well as Linux, When i look up things on the internet about Linux Flavours, They are written so complex that it is difficult for me to understand, i am asking if...
4
by: Eggnog | last post by:
Hi, Is there a newsgroups for beginners questions? Cheers, Nawg
6
by: William Foster | last post by:
Does anyone know of a good online tutorial for C# focused on beginners. I have been to many great sites like csharpfriends, csharp-corner etc looking for good tutorials and have had no luck. Any...
4
by: aman firoz | last post by:
do you people got anything for c beginners..... help me out guys
0
by: Dual_b00t | last post by:
hi i created a site called PHP Together its for beginners also for gurus to help out the beginners if you are learning PHP and feel alone then drop by . ciao Mark
19
by: yltkhuu | last post by:
1. How does having a widely adopted C++ standard help game programmers? 2. What are the advantages ans disadvantages of employing the "using" directive? 3. Why might you define a new name for an...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.